From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0001.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0002.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0001.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0004.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0002.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0002.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0005.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0003.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0003.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0001.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0006.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0004.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0004.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0002.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0001.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0007.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0005.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0005.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0004.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0002.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0001.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment.html From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0008.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0006.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0006.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0005.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0003.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0003.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0001.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0001.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0001.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0001.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0009.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0007.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0007.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0006.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0004.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0004.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0003.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0002.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0002.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0002.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0002.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0002.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0002.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0001.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0003.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0010.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0008.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0008.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0007.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0005.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0005.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0004.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0003.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0003.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0003.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0003.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0003.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0002.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0004.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0002.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0005.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0001.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0001.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0001.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0001.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0011.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0009.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0009.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0008.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0006.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0006.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0005.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0004.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0004.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0004.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0004.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0004.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0003.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0006.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0003.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0007.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0003.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0003.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0003.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0002.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0002.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0002.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0002.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0002.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment.html From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0012.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0010.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0010.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0009.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0007.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0007.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0006.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0005.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0005.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0005.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0005.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0005.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0004.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0008.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0004.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0009.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0004.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0004.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0004.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0003.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0003.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0003.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0003.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0003.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0001.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0013.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0011.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0011.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0010.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0008.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0008.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0007.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0006.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0006.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0006.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0006.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0006.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0005.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0010.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0005.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0011.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0005.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0005.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0005.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0004.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0004.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0004.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0004.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0004.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0003.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment.html From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0014.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0012.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0012.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0011.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0009.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0009.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0008.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0007.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0007.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0007.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0007.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0007.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0006.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0012.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0006.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0013.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0006.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0006.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0006.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0005.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0005.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0005.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0005.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0005.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0004.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0002.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0001.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0001.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0015.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0013.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0013.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0012.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0010.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0010.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0009.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0008.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0008.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0008.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0008.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0008.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0007.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0014.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0007.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0015.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0007.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0007.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0007.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0006.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0006.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0006.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0006.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0006.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0005.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0003.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0003.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0003.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0016.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0014.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0014.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0013.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0011.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0011.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0010.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0009.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0009.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0009.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0009.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0009.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0008.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0016.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0008.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0017.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0008.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0008.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0008.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0007.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0007.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0007.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0007.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0007.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0006.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0004.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0004.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0004.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0017.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0015.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0015.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0014.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0012.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0012.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0011.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0010.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0010.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0010.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0010.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0010.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0009.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0018.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0009.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0019.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0009.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0009.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0009.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0008.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0008.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0008.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0008.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0008.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0007.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0005.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0005.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0005.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0001.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0018.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0016.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0016.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0015.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0013.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0013.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0012.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0011.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0011.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0011.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0011.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0011.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0010.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0020.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0010.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0021.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0010.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0010.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0010.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0009.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0009.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0009.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0009.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0009.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0008.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0006.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0006.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0006.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0003.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0001.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0019.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0017.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0017.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0016.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0014.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0014.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0013.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0012.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0012.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0012.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0012.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0012.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0011.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0022.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0011.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0023.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0011.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0011.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0011.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0010.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0010.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0010.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0010.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0010.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0009.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0007.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0007.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0007.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0004.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0002.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0020.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0018.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0018.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0017.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0015.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0015.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0014.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0013.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0013.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0013.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0013.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0013.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0012.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0024.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0012.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0025.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0012.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0012.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0012.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0011.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0011.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0011.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0011.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0011.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0010.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0008.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0008.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0008.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0005.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0003.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0002.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0021.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0019.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0019.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0018.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0016.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0016.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0015.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0014.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0014.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0014.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0014.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0014.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0013.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0026.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0013.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0027.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0013.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0013.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0013.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0012.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0012.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0012.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0012.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0012.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0011.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0009.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0009.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0009.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0006.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0004.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0003.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0001.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0001.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0022.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0020.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0020.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0019.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0017.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0017.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0016.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0015.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0015.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0015.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0015.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0015.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0014.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0028.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0014.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0029.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0014.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0014.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0014.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0013.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0013.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0013.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0013.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0013.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0012.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0010.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0010.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0010.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0007.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0005.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0004.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0003.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0003.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Mon Dec 24 05:45:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Mon, 24 Dec 2007 07:45:31 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: On 20-Dec-07, at 06:23 , Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! You should probably contact the Parallels developers to see if they have any suggestions. Andre From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0023.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0021.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0021.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0020.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0018.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0018.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0017.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0016.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0016.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0016.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0016.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0016.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0015.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0030.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0015.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0031.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0015.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0015.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0015.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0014.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0014.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0014.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0014.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0014.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0013.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0011.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0011.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0011.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0008.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0006.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0005.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0004.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0004.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Mon Dec 24 05:45:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Mon, 24 Dec 2007 07:45:31 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: On 20-Dec-07, at 06:23 , Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! You should probably contact the Parallels developers to see if they have any suggestions. Andre From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0024.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0022.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0022.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0021.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0019.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0019.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0018.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0017.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0017.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0017.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0017.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0017.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0016.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0032.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0016.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0033.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0016.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0016.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0016.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0015.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0015.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0015.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0015.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0015.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0014.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0012.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0012.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0012.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0009.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0007.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0006.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0005.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0005.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Mon Dec 24 05:45:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Mon, 24 Dec 2007 07:45:31 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: On 20-Dec-07, at 06:23 , Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! You should probably contact the Parallels developers to see if they have any suggestions. Andre From beat.arnet at gmail.com Tue Dec 25 14:30:48 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 25 Dec 2007 16:30:48 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() Message-ID: <47717688.20002@gmail.com> Hello all, It looks as if setSerialPortParams() is also setting DTR=true. In my application this is undesirable - is there anything that can be done to keep DTR==false while I reconfigure (the speed of) the port? I looked through the JAVA portion of gnu.io and could not find a single place where setDTR(true)is executed. I therefore suspect that DTR is affected by some lower-level (native) code.... Thanks for your help, Beat From tjarvi at qbang.org Tue Dec 25 17:02:59 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 17:02:59 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <47717688.20002@gmail.com> References: <47717688.20002@gmail.com> Message-ID: On Tue, 25 Dec 2007, Beat Arnet wrote: > Hello all, > It looks as if setSerialPortParams() is also setting DTR=true. In my > application this is undesirable - is there anything that can be done to > keep DTR==false while I reconfigure (the speed of) the port? I looked > through the JAVA portion of gnu.io and could not find a single place > where setDTR(true)is executed. I therefore suspect that DTR is affected > by some lower-level (native) code.... > > Thanks for your help, > Beat > The following in RXTXPort.java may help you. I was putting this code in several years ago and never really verified it. The idea is the call will open the port (DTR) will be asserted but after that, the port is 'preopened' meaning your later call to open with not assert the pin. NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX supports though. /** * Extension to CommAPI * This is an extension to CommAPI. It may not be supported on * all operating systems. * * Open the port and set DTR. remove lockfile and do not close * This is so some software can appear to set the DTR before 'opening' * the port a second time later on. * * @return true on success * @throws UnsupportedCommOperationException; * */ public static boolean staticSetDTR( String port, boolean flag ) throws UnsupportedCommOperationException { if ( debug ) z.reportln( "RXTXPort:staticSetDTR( " + port + " " + flag ); return( nativeStaticSetDTR( port, flag ) ); } -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Dec 25 18:36:54 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 18:36:54 -0700 (MST) Subject: [Rxtx] Configure.in update In-Reply-To: References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: On Sat, 22 Dec 2007, Andre-John Mas wrote: > Hi, > > I was just told there is a minor issue in the changes. Basically I was > overwriting any > LDFLAGS and CFLAGS that the user might have set, so the following diff > fixes this. > It is made relative to 1.35.2.76: This should be in CVS Tag commapi-0-0-1 now if you want to try it. Enable universal library builds for Mac OS X Andre-John Mas ajmas at sympatico.ca http://mailman.qbang.org/pipermail/rxtx/2007-December/1793319.ht ml -- Trent Jarvi tjarvi at qbang.org From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0025.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0023.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0023.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0022.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0020.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0020.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0019.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0018.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0018.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0018.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0018.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0018.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0017.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0034.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0017.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0035.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0017.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0017.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0017.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0016.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0016.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0016.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0016.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0016.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0015.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0013.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0013.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0013.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0010.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0008.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0007.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0006.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0006.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Mon Dec 24 05:45:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Mon, 24 Dec 2007 07:45:31 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: On 20-Dec-07, at 06:23 , Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! You should probably contact the Parallels developers to see if they have any suggestions. Andre From beat.arnet at gmail.com Tue Dec 25 14:30:48 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 25 Dec 2007 16:30:48 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() Message-ID: <47717688.20002@gmail.com> Hello all, It looks as if setSerialPortParams() is also setting DTR=true. In my application this is undesirable - is there anything that can be done to keep DTR==false while I reconfigure (the speed of) the port? I looked through the JAVA portion of gnu.io and could not find a single place where setDTR(true)is executed. I therefore suspect that DTR is affected by some lower-level (native) code.... Thanks for your help, Beat From tjarvi at qbang.org Tue Dec 25 17:02:59 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 17:02:59 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <47717688.20002@gmail.com> References: <47717688.20002@gmail.com> Message-ID: On Tue, 25 Dec 2007, Beat Arnet wrote: > Hello all, > It looks as if setSerialPortParams() is also setting DTR=true. In my > application this is undesirable - is there anything that can be done to > keep DTR==false while I reconfigure (the speed of) the port? I looked > through the JAVA portion of gnu.io and could not find a single place > where setDTR(true)is executed. I therefore suspect that DTR is affected > by some lower-level (native) code.... > > Thanks for your help, > Beat > The following in RXTXPort.java may help you. I was putting this code in several years ago and never really verified it. The idea is the call will open the port (DTR) will be asserted but after that, the port is 'preopened' meaning your later call to open with not assert the pin. NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX supports though. /** * Extension to CommAPI * This is an extension to CommAPI. It may not be supported on * all operating systems. * * Open the port and set DTR. remove lockfile and do not close * This is so some software can appear to set the DTR before 'opening' * the port a second time later on. * * @return true on success * @throws UnsupportedCommOperationException; * */ public static boolean staticSetDTR( String port, boolean flag ) throws UnsupportedCommOperationException { if ( debug ) z.reportln( "RXTXPort:staticSetDTR( " + port + " " + flag ); return( nativeStaticSetDTR( port, flag ) ); } -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Dec 25 18:36:54 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 18:36:54 -0700 (MST) Subject: [Rxtx] Configure.in update In-Reply-To: References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: On Sat, 22 Dec 2007, Andre-John Mas wrote: > Hi, > > I was just told there is a minor issue in the changes. Basically I was > overwriting any > LDFLAGS and CFLAGS that the user might have set, so the following diff > fixes this. > It is made relative to 1.35.2.76: This should be in CVS Tag commapi-0-0-1 now if you want to try it. Enable universal library builds for Mac OS X Andre-John Mas ajmas at sympatico.ca http://mailman.qbang.org/pipermail/rxtx/2007-December/1793319.ht ml -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Wed Dec 26 12:52:06 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Wed, 26 Dec 2007 14:52:06 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: References: <47717688.20002@gmail.com> Message-ID: <4772B0E6.2050803@gmail.com> Hello Trent, Thank you so much for the quick response! I have tried your suggestion, by calling staticSetDTR("COM1", false) before opening the port. Afterwards, I open the serial port and setDTR(true) followed by setDTR(false), which resets the target that I am attempting to program over RS-232. Then, I download the first portion of the code at a low transmission rate. After that, I need to reconfigure the port to run at a faster rate, for which I call setSerialPortParams() - unfortunately, even with the initial staticSetDTR call that you recommended, the setSerialPortParams() call still sets DTR=true, resulting in an unwanted reset of the target. Also, any subsequent call to staticSetDTR (after the port has been opened) results in the following error: Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The system cannot find the file specified. Am I using the staticSetDTR function as you intended and/or is there anything else that I should try? Regards, Beat Trent Jarvi wrote: > On Tue, 25 Dec 2007, Beat Arnet wrote: > >> Hello all, >> It looks as if setSerialPortParams() is also setting DTR=true. In my >> application this is undesirable - is there anything that can be done to >> keep DTR==false while I reconfigure (the speed of) the port? I looked >> through the JAVA portion of gnu.io and could not find a single place >> where setDTR(true)is executed. I therefore suspect that DTR is affected >> by some lower-level (native) code.... >> >> Thanks for your help, >> Beat >> > > The following in RXTXPort.java may help you. I was putting this code > in several years ago and never really verified it. The idea is the > call will open the port (DTR) will be asserted but after that, the > port is 'preopened' meaning your later call to open with not assert > the pin. > > NOTE: This is not part of CommAPI. I think it will work on the OS's > RXTX supports though. > > > /** > * Extension to CommAPI > * This is an extension to CommAPI. It may not be supported on > * all operating systems. > * > * Open the port and set DTR. remove lockfile and do not close > * This is so some software can appear to set the DTR before 'opening' > * the port a second time later on. > * > * @return true on success > * @throws UnsupportedCommOperationException; > * > */ > > public static boolean staticSetDTR( String port, boolean flag ) > throws UnsupportedCommOperationException > { > if ( debug ) > z.reportln( "RXTXPort:staticSetDTR( " + port + > " " + flag ); > return( nativeStaticSetDTR( port, flag ) ); > } > > -- > Trent Jarvi > tjarvi at qbang.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/101ad642/attachment.html From rxtx at qbang.org Wed Dec 26 15:19:24 2007 From: rxtx at qbang.org (Doctor Claudette Gary) Date: Wed, 26 Dec 2007 15:19:24 -0700 Subject: [Rxtx] December 73% OFF Message-ID: <20071226-61924.19969.qmail@pool-71-160-100-227.lsanca.dsl-w.verizon.net> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/da5385e0/attachment.html From tjarvi at qbang.org Wed Dec 26 17:48:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 26 Dec 2007 17:48:53 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <4772B0E6.2050803@gmail.com> References: <47717688.20002@gmail.com> <4772B0E6.2050803@gmail.com> Message-ID: staticSet* would be passed the filename ("COM1" for instance) even after opening the port. There may be another subtle bug there. As I mentioned that code was never tested. It looks like the problem with DTR asserting is in termios.c:tcsetattr() /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; This function is called towards the end of setSerialPortParams in SerialImp.c. The static version will do the same. The solution may be to just remove the code that tries to fiddle with DTR while trying to emulate the termios struct. One way to test the theory would be to try it out on a Linux/Mac/Solaris box since they don't go into termios.c. Presumably they would work. Taking out that DTR code might introduce an incompatability for existing code since some devices will not communicate until it is asserted. Not that we would not do it, but it is not a change without risk. On Wed, 26 Dec 2007, Beat Arnet wrote: > Hello Trent, > > Thank you so much for the quick response! > > I have tried your suggestion, by calling staticSetDTR("COM1", false) before > opening the port. > Afterwards, I open the serial port and setDTR(true) followed by > setDTR(false), which resets the target that I am attempting to program over > RS-232. Then, I download the first portion of the code at a low transmission > rate. After that, I need to reconfigure the port to run at a faster rate, for > which I call setSerialPortParams() - unfortunately, even with the initial > staticSetDTR call that you recommended, the setSerialPortParams() call still > sets DTR=true, resulting in an unwanted reset of the target. Also, any > subsequent call to staticSetDTR (after the port has been opened) results in > the following error: > > Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The > system cannot find the file specified. > > Am I using the staticSetDTR function as you intended and/or is there anything > else that I should try? > > Regards, > Beat > > Trent Jarvi wrote: >> On Tue, 25 Dec 2007, Beat Arnet wrote: >> >>> Hello all, >>> It looks as if setSerialPortParams() is also setting DTR=true. In my >>> application this is undesirable - is there anything that can be done to >>> keep DTR==false while I reconfigure (the speed of) the port? I looked >>> through the JAVA portion of gnu.io and could not find a single place >>> where setDTR(true)is executed. I therefore suspect that DTR is affected >>> by some lower-level (native) code.... >>> >>> Thanks for your help, >>> Beat >>> >> >> The following in RXTXPort.java may help you. I was putting this code in >> several years ago and never really verified it. The idea is the call will >> open the port (DTR) will be asserted but after that, the port is >> 'preopened' meaning your later call to open with not assert the pin. >> >> NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX >> supports though. >> >> >> /** >> * Extension to CommAPI >> * This is an extension to CommAPI. It may not be supported on >> * all operating systems. >> * >> * Open the port and set DTR. remove lockfile and do not close >> * This is so some software can appear to set the DTR before 'opening' >> * the port a second time later on. >> * >> * @return true on success >> * @throws UnsupportedCommOperationException; >> * >> */ >> >> public static boolean staticSetDTR( String port, boolean flag ) >> throws UnsupportedCommOperationException >> { >> if ( debug ) >> z.reportln( "RXTXPort:staticSetDTR( " + port + >> " " + flag ); >> return( nativeStaticSetDTR( port, flag ) ); >> } >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> > > From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0026.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0024.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0024.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0023.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0021.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0021.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0020.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0019.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0019.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0019.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0019.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0019.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0018.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0036.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0018.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0037.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0018.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0018.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0018.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0017.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0017.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0017.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0017.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0017.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0016.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0014.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0014.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0014.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0011.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0009.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0008.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0007.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0007.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Mon Dec 24 05:45:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Mon, 24 Dec 2007 07:45:31 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: On 20-Dec-07, at 06:23 , Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! You should probably contact the Parallels developers to see if they have any suggestions. Andre From beat.arnet at gmail.com Tue Dec 25 14:30:48 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 25 Dec 2007 16:30:48 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() Message-ID: <47717688.20002@gmail.com> Hello all, It looks as if setSerialPortParams() is also setting DTR=true. In my application this is undesirable - is there anything that can be done to keep DTR==false while I reconfigure (the speed of) the port? I looked through the JAVA portion of gnu.io and could not find a single place where setDTR(true)is executed. I therefore suspect that DTR is affected by some lower-level (native) code.... Thanks for your help, Beat From tjarvi at qbang.org Tue Dec 25 17:02:59 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 17:02:59 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <47717688.20002@gmail.com> References: <47717688.20002@gmail.com> Message-ID: On Tue, 25 Dec 2007, Beat Arnet wrote: > Hello all, > It looks as if setSerialPortParams() is also setting DTR=true. In my > application this is undesirable - is there anything that can be done to > keep DTR==false while I reconfigure (the speed of) the port? I looked > through the JAVA portion of gnu.io and could not find a single place > where setDTR(true)is executed. I therefore suspect that DTR is affected > by some lower-level (native) code.... > > Thanks for your help, > Beat > The following in RXTXPort.java may help you. I was putting this code in several years ago and never really verified it. The idea is the call will open the port (DTR) will be asserted but after that, the port is 'preopened' meaning your later call to open with not assert the pin. NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX supports though. /** * Extension to CommAPI * This is an extension to CommAPI. It may not be supported on * all operating systems. * * Open the port and set DTR. remove lockfile and do not close * This is so some software can appear to set the DTR before 'opening' * the port a second time later on. * * @return true on success * @throws UnsupportedCommOperationException; * */ public static boolean staticSetDTR( String port, boolean flag ) throws UnsupportedCommOperationException { if ( debug ) z.reportln( "RXTXPort:staticSetDTR( " + port + " " + flag ); return( nativeStaticSetDTR( port, flag ) ); } -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Dec 25 18:36:54 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 18:36:54 -0700 (MST) Subject: [Rxtx] Configure.in update In-Reply-To: References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: On Sat, 22 Dec 2007, Andre-John Mas wrote: > Hi, > > I was just told there is a minor issue in the changes. Basically I was > overwriting any > LDFLAGS and CFLAGS that the user might have set, so the following diff > fixes this. > It is made relative to 1.35.2.76: This should be in CVS Tag commapi-0-0-1 now if you want to try it. Enable universal library builds for Mac OS X Andre-John Mas ajmas at sympatico.ca http://mailman.qbang.org/pipermail/rxtx/2007-December/1793319.ht ml -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Wed Dec 26 12:52:06 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Wed, 26 Dec 2007 14:52:06 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: References: <47717688.20002@gmail.com> Message-ID: <4772B0E6.2050803@gmail.com> Hello Trent, Thank you so much for the quick response! I have tried your suggestion, by calling staticSetDTR("COM1", false) before opening the port. Afterwards, I open the serial port and setDTR(true) followed by setDTR(false), which resets the target that I am attempting to program over RS-232. Then, I download the first portion of the code at a low transmission rate. After that, I need to reconfigure the port to run at a faster rate, for which I call setSerialPortParams() - unfortunately, even with the initial staticSetDTR call that you recommended, the setSerialPortParams() call still sets DTR=true, resulting in an unwanted reset of the target. Also, any subsequent call to staticSetDTR (after the port has been opened) results in the following error: Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The system cannot find the file specified. Am I using the staticSetDTR function as you intended and/or is there anything else that I should try? Regards, Beat Trent Jarvi wrote: > On Tue, 25 Dec 2007, Beat Arnet wrote: > >> Hello all, >> It looks as if setSerialPortParams() is also setting DTR=true. In my >> application this is undesirable - is there anything that can be done to >> keep DTR==false while I reconfigure (the speed of) the port? I looked >> through the JAVA portion of gnu.io and could not find a single place >> where setDTR(true)is executed. I therefore suspect that DTR is affected >> by some lower-level (native) code.... >> >> Thanks for your help, >> Beat >> > > The following in RXTXPort.java may help you. I was putting this code > in several years ago and never really verified it. The idea is the > call will open the port (DTR) will be asserted but after that, the > port is 'preopened' meaning your later call to open with not assert > the pin. > > NOTE: This is not part of CommAPI. I think it will work on the OS's > RXTX supports though. > > > /** > * Extension to CommAPI > * This is an extension to CommAPI. It may not be supported on > * all operating systems. > * > * Open the port and set DTR. remove lockfile and do not close > * This is so some software can appear to set the DTR before 'opening' > * the port a second time later on. > * > * @return true on success > * @throws UnsupportedCommOperationException; > * > */ > > public static boolean staticSetDTR( String port, boolean flag ) > throws UnsupportedCommOperationException > { > if ( debug ) > z.reportln( "RXTXPort:staticSetDTR( " + port + > " " + flag ); > return( nativeStaticSetDTR( port, flag ) ); > } > > -- > Trent Jarvi > tjarvi at qbang.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/101ad642/attachment-0001.html From rxtx at qbang.org Wed Dec 26 15:19:24 2007 From: rxtx at qbang.org (Doctor Claudette Gary) Date: Wed, 26 Dec 2007 15:19:24 -0700 Subject: [Rxtx] December 73% OFF Message-ID: <20071226-61924.19969.qmail@pool-71-160-100-227.lsanca.dsl-w.verizon.net> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/da5385e0/attachment-0001.html From tjarvi at qbang.org Wed Dec 26 17:48:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 26 Dec 2007 17:48:53 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <4772B0E6.2050803@gmail.com> References: <47717688.20002@gmail.com> <4772B0E6.2050803@gmail.com> Message-ID: staticSet* would be passed the filename ("COM1" for instance) even after opening the port. There may be another subtle bug there. As I mentioned that code was never tested. It looks like the problem with DTR asserting is in termios.c:tcsetattr() /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; This function is called towards the end of setSerialPortParams in SerialImp.c. The static version will do the same. The solution may be to just remove the code that tries to fiddle with DTR while trying to emulate the termios struct. One way to test the theory would be to try it out on a Linux/Mac/Solaris box since they don't go into termios.c. Presumably they would work. Taking out that DTR code might introduce an incompatability for existing code since some devices will not communicate until it is asserted. Not that we would not do it, but it is not a change without risk. On Wed, 26 Dec 2007, Beat Arnet wrote: > Hello Trent, > > Thank you so much for the quick response! > > I have tried your suggestion, by calling staticSetDTR("COM1", false) before > opening the port. > Afterwards, I open the serial port and setDTR(true) followed by > setDTR(false), which resets the target that I am attempting to program over > RS-232. Then, I download the first portion of the code at a low transmission > rate. After that, I need to reconfigure the port to run at a faster rate, for > which I call setSerialPortParams() - unfortunately, even with the initial > staticSetDTR call that you recommended, the setSerialPortParams() call still > sets DTR=true, resulting in an unwanted reset of the target. Also, any > subsequent call to staticSetDTR (after the port has been opened) results in > the following error: > > Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The > system cannot find the file specified. > > Am I using the staticSetDTR function as you intended and/or is there anything > else that I should try? > > Regards, > Beat > > Trent Jarvi wrote: >> On Tue, 25 Dec 2007, Beat Arnet wrote: >> >>> Hello all, >>> It looks as if setSerialPortParams() is also setting DTR=true. In my >>> application this is undesirable - is there anything that can be done to >>> keep DTR==false while I reconfigure (the speed of) the port? I looked >>> through the JAVA portion of gnu.io and could not find a single place >>> where setDTR(true)is executed. I therefore suspect that DTR is affected >>> by some lower-level (native) code.... >>> >>> Thanks for your help, >>> Beat >>> >> >> The following in RXTXPort.java may help you. I was putting this code in >> several years ago and never really verified it. The idea is the call will >> open the port (DTR) will be asserted but after that, the port is >> 'preopened' meaning your later call to open with not assert the pin. >> >> NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX >> supports though. >> >> >> /** >> * Extension to CommAPI >> * This is an extension to CommAPI. It may not be supported on >> * all operating systems. >> * >> * Open the port and set DTR. remove lockfile and do not close >> * This is so some software can appear to set the DTR before 'opening' >> * the port a second time later on. >> * >> * @return true on success >> * @throws UnsupportedCommOperationException; >> * >> */ >> >> public static boolean staticSetDTR( String port, boolean flag ) >> throws UnsupportedCommOperationException >> { >> if ( debug ) >> z.reportln( "RXTXPort:staticSetDTR( " + port + >> " " + flag ); >> return( nativeStaticSetDTR( port, flag ) ); >> } >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> > > From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0027.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0025.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0025.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0024.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0022.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0022.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0021.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0020.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0020.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0020.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0020.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0020.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0019.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0038.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0019.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0039.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0019.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0019.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0019.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0018.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0018.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0018.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0018.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0018.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0017.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0015.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0015.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0015.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0012.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0010.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0009.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0008.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0008.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Mon Dec 24 05:45:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Mon, 24 Dec 2007 07:45:31 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: On 20-Dec-07, at 06:23 , Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! You should probably contact the Parallels developers to see if they have any suggestions. Andre From beat.arnet at gmail.com Tue Dec 25 14:30:48 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 25 Dec 2007 16:30:48 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() Message-ID: <47717688.20002@gmail.com> Hello all, It looks as if setSerialPortParams() is also setting DTR=true. In my application this is undesirable - is there anything that can be done to keep DTR==false while I reconfigure (the speed of) the port? I looked through the JAVA portion of gnu.io and could not find a single place where setDTR(true)is executed. I therefore suspect that DTR is affected by some lower-level (native) code.... Thanks for your help, Beat From tjarvi at qbang.org Tue Dec 25 17:02:59 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 17:02:59 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <47717688.20002@gmail.com> References: <47717688.20002@gmail.com> Message-ID: On Tue, 25 Dec 2007, Beat Arnet wrote: > Hello all, > It looks as if setSerialPortParams() is also setting DTR=true. In my > application this is undesirable - is there anything that can be done to > keep DTR==false while I reconfigure (the speed of) the port? I looked > through the JAVA portion of gnu.io and could not find a single place > where setDTR(true)is executed. I therefore suspect that DTR is affected > by some lower-level (native) code.... > > Thanks for your help, > Beat > The following in RXTXPort.java may help you. I was putting this code in several years ago and never really verified it. The idea is the call will open the port (DTR) will be asserted but after that, the port is 'preopened' meaning your later call to open with not assert the pin. NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX supports though. /** * Extension to CommAPI * This is an extension to CommAPI. It may not be supported on * all operating systems. * * Open the port and set DTR. remove lockfile and do not close * This is so some software can appear to set the DTR before 'opening' * the port a second time later on. * * @return true on success * @throws UnsupportedCommOperationException; * */ public static boolean staticSetDTR( String port, boolean flag ) throws UnsupportedCommOperationException { if ( debug ) z.reportln( "RXTXPort:staticSetDTR( " + port + " " + flag ); return( nativeStaticSetDTR( port, flag ) ); } -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Dec 25 18:36:54 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 18:36:54 -0700 (MST) Subject: [Rxtx] Configure.in update In-Reply-To: References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: On Sat, 22 Dec 2007, Andre-John Mas wrote: > Hi, > > I was just told there is a minor issue in the changes. Basically I was > overwriting any > LDFLAGS and CFLAGS that the user might have set, so the following diff > fixes this. > It is made relative to 1.35.2.76: This should be in CVS Tag commapi-0-0-1 now if you want to try it. Enable universal library builds for Mac OS X Andre-John Mas ajmas at sympatico.ca http://mailman.qbang.org/pipermail/rxtx/2007-December/1793319.ht ml -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Wed Dec 26 12:52:06 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Wed, 26 Dec 2007 14:52:06 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: References: <47717688.20002@gmail.com> Message-ID: <4772B0E6.2050803@gmail.com> Hello Trent, Thank you so much for the quick response! I have tried your suggestion, by calling staticSetDTR("COM1", false) before opening the port. Afterwards, I open the serial port and setDTR(true) followed by setDTR(false), which resets the target that I am attempting to program over RS-232. Then, I download the first portion of the code at a low transmission rate. After that, I need to reconfigure the port to run at a faster rate, for which I call setSerialPortParams() - unfortunately, even with the initial staticSetDTR call that you recommended, the setSerialPortParams() call still sets DTR=true, resulting in an unwanted reset of the target. Also, any subsequent call to staticSetDTR (after the port has been opened) results in the following error: Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The system cannot find the file specified. Am I using the staticSetDTR function as you intended and/or is there anything else that I should try? Regards, Beat Trent Jarvi wrote: > On Tue, 25 Dec 2007, Beat Arnet wrote: > >> Hello all, >> It looks as if setSerialPortParams() is also setting DTR=true. In my >> application this is undesirable - is there anything that can be done to >> keep DTR==false while I reconfigure (the speed of) the port? I looked >> through the JAVA portion of gnu.io and could not find a single place >> where setDTR(true)is executed. I therefore suspect that DTR is affected >> by some lower-level (native) code.... >> >> Thanks for your help, >> Beat >> > > The following in RXTXPort.java may help you. I was putting this code > in several years ago and never really verified it. The idea is the > call will open the port (DTR) will be asserted but after that, the > port is 'preopened' meaning your later call to open with not assert > the pin. > > NOTE: This is not part of CommAPI. I think it will work on the OS's > RXTX supports though. > > > /** > * Extension to CommAPI > * This is an extension to CommAPI. It may not be supported on > * all operating systems. > * > * Open the port and set DTR. remove lockfile and do not close > * This is so some software can appear to set the DTR before 'opening' > * the port a second time later on. > * > * @return true on success > * @throws UnsupportedCommOperationException; > * > */ > > public static boolean staticSetDTR( String port, boolean flag ) > throws UnsupportedCommOperationException > { > if ( debug ) > z.reportln( "RXTXPort:staticSetDTR( " + port + > " " + flag ); > return( nativeStaticSetDTR( port, flag ) ); > } > > -- > Trent Jarvi > tjarvi at qbang.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/101ad642/attachment-0002.html From rxtx at qbang.org Wed Dec 26 15:19:24 2007 From: rxtx at qbang.org (Doctor Claudette Gary) Date: Wed, 26 Dec 2007 15:19:24 -0700 Subject: [Rxtx] December 73% OFF Message-ID: <20071226-61924.19969.qmail@pool-71-160-100-227.lsanca.dsl-w.verizon.net> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/da5385e0/attachment-0002.html From tjarvi at qbang.org Wed Dec 26 17:48:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 26 Dec 2007 17:48:53 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <4772B0E6.2050803@gmail.com> References: <47717688.20002@gmail.com> <4772B0E6.2050803@gmail.com> Message-ID: staticSet* would be passed the filename ("COM1" for instance) even after opening the port. There may be another subtle bug there. As I mentioned that code was never tested. It looks like the problem with DTR asserting is in termios.c:tcsetattr() /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; This function is called towards the end of setSerialPortParams in SerialImp.c. The static version will do the same. The solution may be to just remove the code that tries to fiddle with DTR while trying to emulate the termios struct. One way to test the theory would be to try it out on a Linux/Mac/Solaris box since they don't go into termios.c. Presumably they would work. Taking out that DTR code might introduce an incompatability for existing code since some devices will not communicate until it is asserted. Not that we would not do it, but it is not a change without risk. On Wed, 26 Dec 2007, Beat Arnet wrote: > Hello Trent, > > Thank you so much for the quick response! > > I have tried your suggestion, by calling staticSetDTR("COM1", false) before > opening the port. > Afterwards, I open the serial port and setDTR(true) followed by > setDTR(false), which resets the target that I am attempting to program over > RS-232. Then, I download the first portion of the code at a low transmission > rate. After that, I need to reconfigure the port to run at a faster rate, for > which I call setSerialPortParams() - unfortunately, even with the initial > staticSetDTR call that you recommended, the setSerialPortParams() call still > sets DTR=true, resulting in an unwanted reset of the target. Also, any > subsequent call to staticSetDTR (after the port has been opened) results in > the following error: > > Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The > system cannot find the file specified. > > Am I using the staticSetDTR function as you intended and/or is there anything > else that I should try? > > Regards, > Beat > > Trent Jarvi wrote: >> On Tue, 25 Dec 2007, Beat Arnet wrote: >> >>> Hello all, >>> It looks as if setSerialPortParams() is also setting DTR=true. In my >>> application this is undesirable - is there anything that can be done to >>> keep DTR==false while I reconfigure (the speed of) the port? I looked >>> through the JAVA portion of gnu.io and could not find a single place >>> where setDTR(true)is executed. I therefore suspect that DTR is affected >>> by some lower-level (native) code.... >>> >>> Thanks for your help, >>> Beat >>> >> >> The following in RXTXPort.java may help you. I was putting this code in >> several years ago and never really verified it. The idea is the call will >> open the port (DTR) will be asserted but after that, the port is >> 'preopened' meaning your later call to open with not assert the pin. >> >> NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX >> supports though. >> >> >> /** >> * Extension to CommAPI >> * This is an extension to CommAPI. It may not be supported on >> * all operating systems. >> * >> * Open the port and set DTR. remove lockfile and do not close >> * This is so some software can appear to set the DTR before 'opening' >> * the port a second time later on. >> * >> * @return true on success >> * @throws UnsupportedCommOperationException; >> * >> */ >> >> public static boolean staticSetDTR( String port, boolean flag ) >> throws UnsupportedCommOperationException >> { >> if ( debug ) >> z.reportln( "RXTXPort:staticSetDTR( " + port + >> " " + flag ); >> return( nativeStaticSetDTR( port, flag ) ); >> } >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> > > From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0028.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0026.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0026.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0025.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0023.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0023.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0022.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0021.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0021.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0021.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0021.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0021.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0020.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0040.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0020.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0041.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0020.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0020.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0020.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0019.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0019.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0019.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0019.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0019.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0018.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0016.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0016.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0016.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0013.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0011.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0010.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0009.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0009.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Mon Dec 24 05:45:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Mon, 24 Dec 2007 07:45:31 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: On 20-Dec-07, at 06:23 , Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! You should probably contact the Parallels developers to see if they have any suggestions. Andre From beat.arnet at gmail.com Tue Dec 25 14:30:48 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 25 Dec 2007 16:30:48 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() Message-ID: <47717688.20002@gmail.com> Hello all, It looks as if setSerialPortParams() is also setting DTR=true. In my application this is undesirable - is there anything that can be done to keep DTR==false while I reconfigure (the speed of) the port? I looked through the JAVA portion of gnu.io and could not find a single place where setDTR(true)is executed. I therefore suspect that DTR is affected by some lower-level (native) code.... Thanks for your help, Beat From tjarvi at qbang.org Tue Dec 25 17:02:59 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 17:02:59 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <47717688.20002@gmail.com> References: <47717688.20002@gmail.com> Message-ID: On Tue, 25 Dec 2007, Beat Arnet wrote: > Hello all, > It looks as if setSerialPortParams() is also setting DTR=true. In my > application this is undesirable - is there anything that can be done to > keep DTR==false while I reconfigure (the speed of) the port? I looked > through the JAVA portion of gnu.io and could not find a single place > where setDTR(true)is executed. I therefore suspect that DTR is affected > by some lower-level (native) code.... > > Thanks for your help, > Beat > The following in RXTXPort.java may help you. I was putting this code in several years ago and never really verified it. The idea is the call will open the port (DTR) will be asserted but after that, the port is 'preopened' meaning your later call to open with not assert the pin. NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX supports though. /** * Extension to CommAPI * This is an extension to CommAPI. It may not be supported on * all operating systems. * * Open the port and set DTR. remove lockfile and do not close * This is so some software can appear to set the DTR before 'opening' * the port a second time later on. * * @return true on success * @throws UnsupportedCommOperationException; * */ public static boolean staticSetDTR( String port, boolean flag ) throws UnsupportedCommOperationException { if ( debug ) z.reportln( "RXTXPort:staticSetDTR( " + port + " " + flag ); return( nativeStaticSetDTR( port, flag ) ); } -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Dec 25 18:36:54 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 18:36:54 -0700 (MST) Subject: [Rxtx] Configure.in update In-Reply-To: References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: On Sat, 22 Dec 2007, Andre-John Mas wrote: > Hi, > > I was just told there is a minor issue in the changes. Basically I was > overwriting any > LDFLAGS and CFLAGS that the user might have set, so the following diff > fixes this. > It is made relative to 1.35.2.76: This should be in CVS Tag commapi-0-0-1 now if you want to try it. Enable universal library builds for Mac OS X Andre-John Mas ajmas at sympatico.ca http://mailman.qbang.org/pipermail/rxtx/2007-December/1793319.ht ml -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Wed Dec 26 12:52:06 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Wed, 26 Dec 2007 14:52:06 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: References: <47717688.20002@gmail.com> Message-ID: <4772B0E6.2050803@gmail.com> Hello Trent, Thank you so much for the quick response! I have tried your suggestion, by calling staticSetDTR("COM1", false) before opening the port. Afterwards, I open the serial port and setDTR(true) followed by setDTR(false), which resets the target that I am attempting to program over RS-232. Then, I download the first portion of the code at a low transmission rate. After that, I need to reconfigure the port to run at a faster rate, for which I call setSerialPortParams() - unfortunately, even with the initial staticSetDTR call that you recommended, the setSerialPortParams() call still sets DTR=true, resulting in an unwanted reset of the target. Also, any subsequent call to staticSetDTR (after the port has been opened) results in the following error: Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The system cannot find the file specified. Am I using the staticSetDTR function as you intended and/or is there anything else that I should try? Regards, Beat Trent Jarvi wrote: > On Tue, 25 Dec 2007, Beat Arnet wrote: > >> Hello all, >> It looks as if setSerialPortParams() is also setting DTR=true. In my >> application this is undesirable - is there anything that can be done to >> keep DTR==false while I reconfigure (the speed of) the port? I looked >> through the JAVA portion of gnu.io and could not find a single place >> where setDTR(true)is executed. I therefore suspect that DTR is affected >> by some lower-level (native) code.... >> >> Thanks for your help, >> Beat >> > > The following in RXTXPort.java may help you. I was putting this code > in several years ago and never really verified it. The idea is the > call will open the port (DTR) will be asserted but after that, the > port is 'preopened' meaning your later call to open with not assert > the pin. > > NOTE: This is not part of CommAPI. I think it will work on the OS's > RXTX supports though. > > > /** > * Extension to CommAPI > * This is an extension to CommAPI. It may not be supported on > * all operating systems. > * > * Open the port and set DTR. remove lockfile and do not close > * This is so some software can appear to set the DTR before 'opening' > * the port a second time later on. > * > * @return true on success > * @throws UnsupportedCommOperationException; > * > */ > > public static boolean staticSetDTR( String port, boolean flag ) > throws UnsupportedCommOperationException > { > if ( debug ) > z.reportln( "RXTXPort:staticSetDTR( " + port + > " " + flag ); > return( nativeStaticSetDTR( port, flag ) ); > } > > -- > Trent Jarvi > tjarvi at qbang.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/101ad642/attachment-0003.html From rxtx at qbang.org Wed Dec 26 15:19:24 2007 From: rxtx at qbang.org (Doctor Claudette Gary) Date: Wed, 26 Dec 2007 15:19:24 -0700 Subject: [Rxtx] December 73% OFF Message-ID: <20071226-61924.19969.qmail@pool-71-160-100-227.lsanca.dsl-w.verizon.net> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/da5385e0/attachment-0003.html From tjarvi at qbang.org Wed Dec 26 17:48:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 26 Dec 2007 17:48:53 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <4772B0E6.2050803@gmail.com> References: <47717688.20002@gmail.com> <4772B0E6.2050803@gmail.com> Message-ID: staticSet* would be passed the filename ("COM1" for instance) even after opening the port. There may be another subtle bug there. As I mentioned that code was never tested. It looks like the problem with DTR asserting is in termios.c:tcsetattr() /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; This function is called towards the end of setSerialPortParams in SerialImp.c. The static version will do the same. The solution may be to just remove the code that tries to fiddle with DTR while trying to emulate the termios struct. One way to test the theory would be to try it out on a Linux/Mac/Solaris box since they don't go into termios.c. Presumably they would work. Taking out that DTR code might introduce an incompatability for existing code since some devices will not communicate until it is asserted. Not that we would not do it, but it is not a change without risk. On Wed, 26 Dec 2007, Beat Arnet wrote: > Hello Trent, > > Thank you so much for the quick response! > > I have tried your suggestion, by calling staticSetDTR("COM1", false) before > opening the port. > Afterwards, I open the serial port and setDTR(true) followed by > setDTR(false), which resets the target that I am attempting to program over > RS-232. Then, I download the first portion of the code at a low transmission > rate. After that, I need to reconfigure the port to run at a faster rate, for > which I call setSerialPortParams() - unfortunately, even with the initial > staticSetDTR call that you recommended, the setSerialPortParams() call still > sets DTR=true, resulting in an unwanted reset of the target. Also, any > subsequent call to staticSetDTR (after the port has been opened) results in > the following error: > > Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The > system cannot find the file specified. > > Am I using the staticSetDTR function as you intended and/or is there anything > else that I should try? > > Regards, > Beat > > Trent Jarvi wrote: >> On Tue, 25 Dec 2007, Beat Arnet wrote: >> >>> Hello all, >>> It looks as if setSerialPortParams() is also setting DTR=true. In my >>> application this is undesirable - is there anything that can be done to >>> keep DTR==false while I reconfigure (the speed of) the port? I looked >>> through the JAVA portion of gnu.io and could not find a single place >>> where setDTR(true)is executed. I therefore suspect that DTR is affected >>> by some lower-level (native) code.... >>> >>> Thanks for your help, >>> Beat >>> >> >> The following in RXTXPort.java may help you. I was putting this code in >> several years ago and never really verified it. The idea is the call will >> open the port (DTR) will be asserted but after that, the port is >> 'preopened' meaning your later call to open with not assert the pin. >> >> NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX >> supports though. >> >> >> /** >> * Extension to CommAPI >> * This is an extension to CommAPI. It may not be supported on >> * all operating systems. >> * >> * Open the port and set DTR. remove lockfile and do not close >> * This is so some software can appear to set the DTR before 'opening' >> * the port a second time later on. >> * >> * @return true on success >> * @throws UnsupportedCommOperationException; >> * >> */ >> >> public static boolean staticSetDTR( String port, boolean flag ) >> throws UnsupportedCommOperationException >> { >> if ( debug ) >> z.reportln( "RXTXPort:staticSetDTR( " + port + >> " " + flag ); >> return( nativeStaticSetDTR( port, flag ) ); >> } >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> > > From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0029.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0027.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0027.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0026.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0024.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0024.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0023.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0022.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0022.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0022.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0022.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0022.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0021.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0042.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0021.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0043.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0021.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0021.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0021.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0020.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0020.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0020.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0020.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0020.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0019.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0017.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0017.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0017.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0014.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0012.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0011.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0010.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0010.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Mon Dec 24 05:45:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Mon, 24 Dec 2007 07:45:31 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: On 20-Dec-07, at 06:23 , Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! You should probably contact the Parallels developers to see if they have any suggestions. Andre From beat.arnet at gmail.com Tue Dec 25 14:30:48 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 25 Dec 2007 16:30:48 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() Message-ID: <47717688.20002@gmail.com> Hello all, It looks as if setSerialPortParams() is also setting DTR=true. In my application this is undesirable - is there anything that can be done to keep DTR==false while I reconfigure (the speed of) the port? I looked through the JAVA portion of gnu.io and could not find a single place where setDTR(true)is executed. I therefore suspect that DTR is affected by some lower-level (native) code.... Thanks for your help, Beat From tjarvi at qbang.org Tue Dec 25 17:02:59 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 17:02:59 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <47717688.20002@gmail.com> References: <47717688.20002@gmail.com> Message-ID: On Tue, 25 Dec 2007, Beat Arnet wrote: > Hello all, > It looks as if setSerialPortParams() is also setting DTR=true. In my > application this is undesirable - is there anything that can be done to > keep DTR==false while I reconfigure (the speed of) the port? I looked > through the JAVA portion of gnu.io and could not find a single place > where setDTR(true)is executed. I therefore suspect that DTR is affected > by some lower-level (native) code.... > > Thanks for your help, > Beat > The following in RXTXPort.java may help you. I was putting this code in several years ago and never really verified it. The idea is the call will open the port (DTR) will be asserted but after that, the port is 'preopened' meaning your later call to open with not assert the pin. NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX supports though. /** * Extension to CommAPI * This is an extension to CommAPI. It may not be supported on * all operating systems. * * Open the port and set DTR. remove lockfile and do not close * This is so some software can appear to set the DTR before 'opening' * the port a second time later on. * * @return true on success * @throws UnsupportedCommOperationException; * */ public static boolean staticSetDTR( String port, boolean flag ) throws UnsupportedCommOperationException { if ( debug ) z.reportln( "RXTXPort:staticSetDTR( " + port + " " + flag ); return( nativeStaticSetDTR( port, flag ) ); } -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Dec 25 18:36:54 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 18:36:54 -0700 (MST) Subject: [Rxtx] Configure.in update In-Reply-To: References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: On Sat, 22 Dec 2007, Andre-John Mas wrote: > Hi, > > I was just told there is a minor issue in the changes. Basically I was > overwriting any > LDFLAGS and CFLAGS that the user might have set, so the following diff > fixes this. > It is made relative to 1.35.2.76: This should be in CVS Tag commapi-0-0-1 now if you want to try it. Enable universal library builds for Mac OS X Andre-John Mas ajmas at sympatico.ca http://mailman.qbang.org/pipermail/rxtx/2007-December/1793319.ht ml -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Wed Dec 26 12:52:06 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Wed, 26 Dec 2007 14:52:06 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: References: <47717688.20002@gmail.com> Message-ID: <4772B0E6.2050803@gmail.com> Hello Trent, Thank you so much for the quick response! I have tried your suggestion, by calling staticSetDTR("COM1", false) before opening the port. Afterwards, I open the serial port and setDTR(true) followed by setDTR(false), which resets the target that I am attempting to program over RS-232. Then, I download the first portion of the code at a low transmission rate. After that, I need to reconfigure the port to run at a faster rate, for which I call setSerialPortParams() - unfortunately, even with the initial staticSetDTR call that you recommended, the setSerialPortParams() call still sets DTR=true, resulting in an unwanted reset of the target. Also, any subsequent call to staticSetDTR (after the port has been opened) results in the following error: Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The system cannot find the file specified. Am I using the staticSetDTR function as you intended and/or is there anything else that I should try? Regards, Beat Trent Jarvi wrote: > On Tue, 25 Dec 2007, Beat Arnet wrote: > >> Hello all, >> It looks as if setSerialPortParams() is also setting DTR=true. In my >> application this is undesirable - is there anything that can be done to >> keep DTR==false while I reconfigure (the speed of) the port? I looked >> through the JAVA portion of gnu.io and could not find a single place >> where setDTR(true)is executed. I therefore suspect that DTR is affected >> by some lower-level (native) code.... >> >> Thanks for your help, >> Beat >> > > The following in RXTXPort.java may help you. I was putting this code > in several years ago and never really verified it. The idea is the > call will open the port (DTR) will be asserted but after that, the > port is 'preopened' meaning your later call to open with not assert > the pin. > > NOTE: This is not part of CommAPI. I think it will work on the OS's > RXTX supports though. > > > /** > * Extension to CommAPI > * This is an extension to CommAPI. It may not be supported on > * all operating systems. > * > * Open the port and set DTR. remove lockfile and do not close > * This is so some software can appear to set the DTR before 'opening' > * the port a second time later on. > * > * @return true on success > * @throws UnsupportedCommOperationException; > * > */ > > public static boolean staticSetDTR( String port, boolean flag ) > throws UnsupportedCommOperationException > { > if ( debug ) > z.reportln( "RXTXPort:staticSetDTR( " + port + > " " + flag ); > return( nativeStaticSetDTR( port, flag ) ); > } > > -- > Trent Jarvi > tjarvi at qbang.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/101ad642/attachment-0004.html From rxtx at qbang.org Wed Dec 26 15:19:24 2007 From: rxtx at qbang.org (Doctor Claudette Gary) Date: Wed, 26 Dec 2007 15:19:24 -0700 Subject: [Rxtx] December 73% OFF Message-ID: <20071226-61924.19969.qmail@pool-71-160-100-227.lsanca.dsl-w.verizon.net> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/da5385e0/attachment-0004.html From tjarvi at qbang.org Wed Dec 26 17:48:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 26 Dec 2007 17:48:53 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <4772B0E6.2050803@gmail.com> References: <47717688.20002@gmail.com> <4772B0E6.2050803@gmail.com> Message-ID: staticSet* would be passed the filename ("COM1" for instance) even after opening the port. There may be another subtle bug there. As I mentioned that code was never tested. It looks like the problem with DTR asserting is in termios.c:tcsetattr() /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; This function is called towards the end of setSerialPortParams in SerialImp.c. The static version will do the same. The solution may be to just remove the code that tries to fiddle with DTR while trying to emulate the termios struct. One way to test the theory would be to try it out on a Linux/Mac/Solaris box since they don't go into termios.c. Presumably they would work. Taking out that DTR code might introduce an incompatability for existing code since some devices will not communicate until it is asserted. Not that we would not do it, but it is not a change without risk. On Wed, 26 Dec 2007, Beat Arnet wrote: > Hello Trent, > > Thank you so much for the quick response! > > I have tried your suggestion, by calling staticSetDTR("COM1", false) before > opening the port. > Afterwards, I open the serial port and setDTR(true) followed by > setDTR(false), which resets the target that I am attempting to program over > RS-232. Then, I download the first portion of the code at a low transmission > rate. After that, I need to reconfigure the port to run at a faster rate, for > which I call setSerialPortParams() - unfortunately, even with the initial > staticSetDTR call that you recommended, the setSerialPortParams() call still > sets DTR=true, resulting in an unwanted reset of the target. Also, any > subsequent call to staticSetDTR (after the port has been opened) results in > the following error: > > Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The > system cannot find the file specified. > > Am I using the staticSetDTR function as you intended and/or is there anything > else that I should try? > > Regards, > Beat > > Trent Jarvi wrote: >> On Tue, 25 Dec 2007, Beat Arnet wrote: >> >>> Hello all, >>> It looks as if setSerialPortParams() is also setting DTR=true. In my >>> application this is undesirable - is there anything that can be done to >>> keep DTR==false while I reconfigure (the speed of) the port? I looked >>> through the JAVA portion of gnu.io and could not find a single place >>> where setDTR(true)is executed. I therefore suspect that DTR is affected >>> by some lower-level (native) code.... >>> >>> Thanks for your help, >>> Beat >>> >> >> The following in RXTXPort.java may help you. I was putting this code in >> several years ago and never really verified it. The idea is the call will >> open the port (DTR) will be asserted but after that, the port is >> 'preopened' meaning your later call to open with not assert the pin. >> >> NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX >> supports though. >> >> >> /** >> * Extension to CommAPI >> * This is an extension to CommAPI. It may not be supported on >> * all operating systems. >> * >> * Open the port and set DTR. remove lockfile and do not close >> * This is so some software can appear to set the DTR before 'opening' >> * the port a second time later on. >> * >> * @return true on success >> * @throws UnsupportedCommOperationException; >> * >> */ >> >> public static boolean staticSetDTR( String port, boolean flag ) >> throws UnsupportedCommOperationException >> { >> if ( debug ) >> z.reportln( "RXTXPort:staticSetDTR( " + port + >> " " + flag ); >> return( nativeStaticSetDTR( port, flag ) ); >> } >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> > > From will.tatam at red61.com Sun Dec 30 08:20:12 2007 From: will.tatam at red61.com (Will Tatam) Date: Sun, 30 Dec 2007 15:20:12 +0000 Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: References: Message-ID: <4777B72C.2040900@red61.com> See also http://mailman.qbang.org/pipermail/rxtx/2007-November/1813769.html Will Gregory Dupriez wrote: > Hi everybody, > > I currently have some issue with the RXTX library version 2.1-7r2. > When I try to send to send some data to my parallel port, jvm crashes. > But it doesn't happen all the time. It seems to be dependant on the data. > > It seems to be the same issue that the one described on the mailing > list within this post > http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html > > I've put the report of the jvm crash at the end of my mail. > > It's quite an old issue but if somobody has solved the problem, it > will help me a lot. > I already try with different versions of the rxtx library and > different versions of the jvm but with the same result. > > In advance, thanks for your help. > > Regards, > > Gregory Dupriez > > # -- Will Tatam Systems Architect Red61 0845 867 2203 ext 103 From netbeans at gatworks.com Sun Dec 30 09:38:13 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 30 Dec 2007 11:38:13 -0500 Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: <4777B72C.2040900@red61.com> References: <4777B72C.2040900@red61.com> Message-ID: <4777C975.9020804@gatworks.com> Watt OS? Is that also true for the devel src's ? Will Tatam wrote: > See also > > http://mailman.qbang.org/pipermail/rxtx/2007-November/1813769.html > > Will > > Gregory Dupriez wrote: >> Hi everybody, From tjarvi at qbang.org Sun Dec 30 12:50:18 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 30 Dec 2007 12:50:18 -0700 (MST) Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: <4777B72C.2040900@red61.com> References: <4777B72C.2040900@red61.com> Message-ID: On Sun, 30 Dec 2007, Will Tatam wrote: > See also > > http://mailman.qbang.org/pipermail/rxtx/2007-November/1813769.html > > Will > > Gregory Dupriez wrote: >> Hi everybody, >> >> I currently have some issue with the RXTX library version 2.1-7r2. >> When I try to send to send some data to my parallel port, jvm crashes. >> But it doesn't happen all the time. It seems to be dependant on the data. >> >> It seems to be the same issue that the one described on the mailing >> list within this post >> http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html >> >> I've put the report of the jvm crash at the end of my mail. >> >> It's quite an old issue but if somobody has solved the problem, it >> will help me a lot. >> I already try with different versions of the rxtx library and >> different versions of the jvm but with the same result. >> >> In advance, thanks for your help. >> >> Regards, >> >> Gregory Dupriez >> >> # > > Parallel support needs a cleanup. We have been taking patches and including them but I do not know that this issue has been resolved. While looking at bugs like this, reproducability, sporatic nature, OS type and version all help form a picture of the type of problem. I see in the past that we have had a case in which the crash was reproducable by sending 8*N bytes. Is this reproducable for you in the same fassion? I see a couple odd things in the parallel write I would not do today. jbyte *body = (*env)->GetByteArrayElements( env, jbarray, 0 ); unsigned char *bytes = (unsigned char *)malloc( count ); int i; for( i = 0; i < count; i++ ) bytes[ i ] = body[ i + offset ]; The memory is later free'd properly. We do not check that offset is sane. We do not need to malloc. Just use the offset in the array and we can dump the malloc/free plus eliminate a large number of copies. (void * ) ((char *) body + total + offset) The above is used in SerialImp.c writeArray to do that. The other is we never release the ByteArrayElements. This is done in Serialimp.c writeArray also. (*env)->ReleaseByteArrayElements( env, jbarray, body, 0 ); I suspect there are many fixes like this that need to be done for the ParallelImp.c. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 30 18:04:48 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 30 Dec 2007 20:04:48 -0500 Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: References: <4777B72C.2040900@red61.com> Message-ID: <47784030.40201@gatworks.com> > > I suspect there are many fixes like this that need to be done for the > ParallelImp.c. why stop there. for example: > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); what is troubling is the write() >= 0 return; If you are writing one byte, and the system has said that it wrote 0, why do u accept 0 bytes written as acceptable? I am also not too sure under what circumstances the (linux/unix) system will return 0 bytes written, instead of an error ( maybe under NON-BLOCKING i/o settings ). the same with: > #else > if( write( fd, bytes, count ) < 0 ) > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeArray" ); > #endif if write() does not return count, then there is also a failure to write *all* the data. From tjarvi at qbang.org Sun Dec 30 18:48:13 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 30 Dec 2007 18:48:13 -0700 (MST) Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: <47784030.40201@gatworks.com> References: <4777B72C.2040900@red61.com> <47784030.40201@gatworks.com> Message-ID: On Sun, 30 Dec 2007, U. George wrote: >> >> I suspect there are many fixes like this that need to be done for the >> ParallelImp.c. > > why stop there. > for example: >> JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, >> jobject jobj, jint ji ) >> { >> unsigned char byte = (unsigned char)ji; >> int fd = get_java_var( env, jobj,"fd","I" ); >> >> #ifdef WIN32 >> DWORD countWritten; /* Fixme, should be a loop until all is written >> */ >> if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), >> &countWritten, NULL ) < 0 ) return; >> #else >> if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; >> #endif >> throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > what is troubling is the write() >= 0 return; If you are writing one byte, > and the system has said that it wrote 0, why do u accept 0 bytes written as > acceptable? > I am also not too sure under what circumstances the (linux/unix) system will > return 0 bytes written, instead of an error ( maybe under NON-BLOCKING i/o > settings ). > > the same with: >> #else >> if( write( fd, bytes, count ) < 0 ) >> throw_java_exception_system_msg( env, IO_EXCEPTION, >> "writeArray" ); >> #endif > > if write() does not return count, then there is also a failure to write *all* > the data. > Agreed. I was just looking at possible causes of segv. The ParallelImp.c was initially a copy of the SerialImp.c back in ~1997. I hooked it up to a printer and sent "asdf." Shocked that it printed on Linux, I shipped it. Since then, there has been nominal interest in the w32 portion which has been encorperated. Maybe we should jump on irc one night and have fun cleaning it up. It could be fun. My fear with cleaning it up is people will start depending upon it and there is not enough interest in Parallel support to sustain itself. I've tried to be very clear about the state of that code. You don't have to read far in the code to find the following: It compiles and ParallelBlackBox runs. No further guarantees. Well... One.. it will print "Hello World!" on an epson DX 10 printer. you know.. the 10 character per second daisy wheel printer ;) - Trent Jarvi Unlike serial support, nobody is running tests for regressions that I know of. That's bad and good. We may break people but I'm not afraid of breaking them. It's truely a free for all with fixes. The main interest, as I understand, is supporting (legacy?) POS parallel port devices. I'm not sure this is realistic. If people are really going to do this, we need at least a hint that they have a test suite for what they need from the library. The second interest is supporting hobby devices that need to control 8 lines with basic on/off capability. LEDs for instance. That I would be interested in making work. -- Trent Jarvi tjarvi at qbang.org From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0030.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0028.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0028.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0027.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0025.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0025.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0024.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0023.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0023.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0023.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0023.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0023.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0022.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0044.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0022.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0045.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0022.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0022.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0022.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0021.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0021.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0021.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0021.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0021.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0020.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0018.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0018.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0018.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0015.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0013.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0012.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0011.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0011.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Mon Dec 24 05:45:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Mon, 24 Dec 2007 07:45:31 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: On 20-Dec-07, at 06:23 , Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! You should probably contact the Parallels developers to see if they have any suggestions. Andre From beat.arnet at gmail.com Tue Dec 25 14:30:48 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 25 Dec 2007 16:30:48 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() Message-ID: <47717688.20002@gmail.com> Hello all, It looks as if setSerialPortParams() is also setting DTR=true. In my application this is undesirable - is there anything that can be done to keep DTR==false while I reconfigure (the speed of) the port? I looked through the JAVA portion of gnu.io and could not find a single place where setDTR(true)is executed. I therefore suspect that DTR is affected by some lower-level (native) code.... Thanks for your help, Beat From tjarvi at qbang.org Tue Dec 25 17:02:59 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 17:02:59 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <47717688.20002@gmail.com> References: <47717688.20002@gmail.com> Message-ID: On Tue, 25 Dec 2007, Beat Arnet wrote: > Hello all, > It looks as if setSerialPortParams() is also setting DTR=true. In my > application this is undesirable - is there anything that can be done to > keep DTR==false while I reconfigure (the speed of) the port? I looked > through the JAVA portion of gnu.io and could not find a single place > where setDTR(true)is executed. I therefore suspect that DTR is affected > by some lower-level (native) code.... > > Thanks for your help, > Beat > The following in RXTXPort.java may help you. I was putting this code in several years ago and never really verified it. The idea is the call will open the port (DTR) will be asserted but after that, the port is 'preopened' meaning your later call to open with not assert the pin. NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX supports though. /** * Extension to CommAPI * This is an extension to CommAPI. It may not be supported on * all operating systems. * * Open the port and set DTR. remove lockfile and do not close * This is so some software can appear to set the DTR before 'opening' * the port a second time later on. * * @return true on success * @throws UnsupportedCommOperationException; * */ public static boolean staticSetDTR( String port, boolean flag ) throws UnsupportedCommOperationException { if ( debug ) z.reportln( "RXTXPort:staticSetDTR( " + port + " " + flag ); return( nativeStaticSetDTR( port, flag ) ); } -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Dec 25 18:36:54 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 18:36:54 -0700 (MST) Subject: [Rxtx] Configure.in update In-Reply-To: References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: On Sat, 22 Dec 2007, Andre-John Mas wrote: > Hi, > > I was just told there is a minor issue in the changes. Basically I was > overwriting any > LDFLAGS and CFLAGS that the user might have set, so the following diff > fixes this. > It is made relative to 1.35.2.76: This should be in CVS Tag commapi-0-0-1 now if you want to try it. Enable universal library builds for Mac OS X Andre-John Mas ajmas at sympatico.ca http://mailman.qbang.org/pipermail/rxtx/2007-December/1793319.ht ml -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Wed Dec 26 12:52:06 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Wed, 26 Dec 2007 14:52:06 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: References: <47717688.20002@gmail.com> Message-ID: <4772B0E6.2050803@gmail.com> Hello Trent, Thank you so much for the quick response! I have tried your suggestion, by calling staticSetDTR("COM1", false) before opening the port. Afterwards, I open the serial port and setDTR(true) followed by setDTR(false), which resets the target that I am attempting to program over RS-232. Then, I download the first portion of the code at a low transmission rate. After that, I need to reconfigure the port to run at a faster rate, for which I call setSerialPortParams() - unfortunately, even with the initial staticSetDTR call that you recommended, the setSerialPortParams() call still sets DTR=true, resulting in an unwanted reset of the target. Also, any subsequent call to staticSetDTR (after the port has been opened) results in the following error: Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The system cannot find the file specified. Am I using the staticSetDTR function as you intended and/or is there anything else that I should try? Regards, Beat Trent Jarvi wrote: > On Tue, 25 Dec 2007, Beat Arnet wrote: > >> Hello all, >> It looks as if setSerialPortParams() is also setting DTR=true. In my >> application this is undesirable - is there anything that can be done to >> keep DTR==false while I reconfigure (the speed of) the port? I looked >> through the JAVA portion of gnu.io and could not find a single place >> where setDTR(true)is executed. I therefore suspect that DTR is affected >> by some lower-level (native) code.... >> >> Thanks for your help, >> Beat >> > > The following in RXTXPort.java may help you. I was putting this code > in several years ago and never really verified it. The idea is the > call will open the port (DTR) will be asserted but after that, the > port is 'preopened' meaning your later call to open with not assert > the pin. > > NOTE: This is not part of CommAPI. I think it will work on the OS's > RXTX supports though. > > > /** > * Extension to CommAPI > * This is an extension to CommAPI. It may not be supported on > * all operating systems. > * > * Open the port and set DTR. remove lockfile and do not close > * This is so some software can appear to set the DTR before 'opening' > * the port a second time later on. > * > * @return true on success > * @throws UnsupportedCommOperationException; > * > */ > > public static boolean staticSetDTR( String port, boolean flag ) > throws UnsupportedCommOperationException > { > if ( debug ) > z.reportln( "RXTXPort:staticSetDTR( " + port + > " " + flag ); > return( nativeStaticSetDTR( port, flag ) ); > } > > -- > Trent Jarvi > tjarvi at qbang.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/101ad642/attachment-0006.html From rxtx at qbang.org Wed Dec 26 15:19:24 2007 From: rxtx at qbang.org (Doctor Claudette Gary) Date: Wed, 26 Dec 2007 15:19:24 -0700 Subject: [Rxtx] December 73% OFF Message-ID: <20071226-61924.19969.qmail@pool-71-160-100-227.lsanca.dsl-w.verizon.net> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/da5385e0/attachment-0006.html From tjarvi at qbang.org Wed Dec 26 17:48:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 26 Dec 2007 17:48:53 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <4772B0E6.2050803@gmail.com> References: <47717688.20002@gmail.com> <4772B0E6.2050803@gmail.com> Message-ID: staticSet* would be passed the filename ("COM1" for instance) even after opening the port. There may be another subtle bug there. As I mentioned that code was never tested. It looks like the problem with DTR asserting is in termios.c:tcsetattr() /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; This function is called towards the end of setSerialPortParams in SerialImp.c. The static version will do the same. The solution may be to just remove the code that tries to fiddle with DTR while trying to emulate the termios struct. One way to test the theory would be to try it out on a Linux/Mac/Solaris box since they don't go into termios.c. Presumably they would work. Taking out that DTR code might introduce an incompatability for existing code since some devices will not communicate until it is asserted. Not that we would not do it, but it is not a change without risk. On Wed, 26 Dec 2007, Beat Arnet wrote: > Hello Trent, > > Thank you so much for the quick response! > > I have tried your suggestion, by calling staticSetDTR("COM1", false) before > opening the port. > Afterwards, I open the serial port and setDTR(true) followed by > setDTR(false), which resets the target that I am attempting to program over > RS-232. Then, I download the first portion of the code at a low transmission > rate. After that, I need to reconfigure the port to run at a faster rate, for > which I call setSerialPortParams() - unfortunately, even with the initial > staticSetDTR call that you recommended, the setSerialPortParams() call still > sets DTR=true, resulting in an unwanted reset of the target. Also, any > subsequent call to staticSetDTR (after the port has been opened) results in > the following error: > > Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The > system cannot find the file specified. > > Am I using the staticSetDTR function as you intended and/or is there anything > else that I should try? > > Regards, > Beat > > Trent Jarvi wrote: >> On Tue, 25 Dec 2007, Beat Arnet wrote: >> >>> Hello all, >>> It looks as if setSerialPortParams() is also setting DTR=true. In my >>> application this is undesirable - is there anything that can be done to >>> keep DTR==false while I reconfigure (the speed of) the port? I looked >>> through the JAVA portion of gnu.io and could not find a single place >>> where setDTR(true)is executed. I therefore suspect that DTR is affected >>> by some lower-level (native) code.... >>> >>> Thanks for your help, >>> Beat >>> >> >> The following in RXTXPort.java may help you. I was putting this code in >> several years ago and never really verified it. The idea is the call will >> open the port (DTR) will be asserted but after that, the port is >> 'preopened' meaning your later call to open with not assert the pin. >> >> NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX >> supports though. >> >> >> /** >> * Extension to CommAPI >> * This is an extension to CommAPI. It may not be supported on >> * all operating systems. >> * >> * Open the port and set DTR. remove lockfile and do not close >> * This is so some software can appear to set the DTR before 'opening' >> * the port a second time later on. >> * >> * @return true on success >> * @throws UnsupportedCommOperationException; >> * >> */ >> >> public static boolean staticSetDTR( String port, boolean flag ) >> throws UnsupportedCommOperationException >> { >> if ( debug ) >> z.reportln( "RXTXPort:staticSetDTR( " + port + >> " " + flag ); >> return( nativeStaticSetDTR( port, flag ) ); >> } >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> > > From will.tatam at red61.com Sun Dec 30 08:20:12 2007 From: will.tatam at red61.com (Will Tatam) Date: Sun, 30 Dec 2007 15:20:12 +0000 Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: References: Message-ID: <4777B72C.2040900@red61.com> See also http://mailman.qbang.org/pipermail/rxtx/2007-November/1813769.html Will Gregory Dupriez wrote: > Hi everybody, > > I currently have some issue with the RXTX library version 2.1-7r2. > When I try to send to send some data to my parallel port, jvm crashes. > But it doesn't happen all the time. It seems to be dependant on the data. > > It seems to be the same issue that the one described on the mailing > list within this post > http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html > > I've put the report of the jvm crash at the end of my mail. > > It's quite an old issue but if somobody has solved the problem, it > will help me a lot. > I already try with different versions of the rxtx library and > different versions of the jvm but with the same result. > > In advance, thanks for your help. > > Regards, > > Gregory Dupriez > > # -- Will Tatam Systems Architect Red61 0845 867 2203 ext 103 From netbeans at gatworks.com Sun Dec 30 09:38:13 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 30 Dec 2007 11:38:13 -0500 Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: <4777B72C.2040900@red61.com> References: <4777B72C.2040900@red61.com> Message-ID: <4777C975.9020804@gatworks.com> Watt OS? Is that also true for the devel src's ? Will Tatam wrote: > See also > > http://mailman.qbang.org/pipermail/rxtx/2007-November/1813769.html > > Will > > Gregory Dupriez wrote: >> Hi everybody, From tjarvi at qbang.org Sun Dec 30 12:50:18 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 30 Dec 2007 12:50:18 -0700 (MST) Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: <4777B72C.2040900@red61.com> References: <4777B72C.2040900@red61.com> Message-ID: On Sun, 30 Dec 2007, Will Tatam wrote: > See also > > http://mailman.qbang.org/pipermail/rxtx/2007-November/1813769.html > > Will > > Gregory Dupriez wrote: >> Hi everybody, >> >> I currently have some issue with the RXTX library version 2.1-7r2. >> When I try to send to send some data to my parallel port, jvm crashes. >> But it doesn't happen all the time. It seems to be dependant on the data. >> >> It seems to be the same issue that the one described on the mailing >> list within this post >> http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html >> >> I've put the report of the jvm crash at the end of my mail. >> >> It's quite an old issue but if somobody has solved the problem, it >> will help me a lot. >> I already try with different versions of the rxtx library and >> different versions of the jvm but with the same result. >> >> In advance, thanks for your help. >> >> Regards, >> >> Gregory Dupriez >> >> # > > Parallel support needs a cleanup. We have been taking patches and including them but I do not know that this issue has been resolved. While looking at bugs like this, reproducability, sporatic nature, OS type and version all help form a picture of the type of problem. I see in the past that we have had a case in which the crash was reproducable by sending 8*N bytes. Is this reproducable for you in the same fassion? I see a couple odd things in the parallel write I would not do today. jbyte *body = (*env)->GetByteArrayElements( env, jbarray, 0 ); unsigned char *bytes = (unsigned char *)malloc( count ); int i; for( i = 0; i < count; i++ ) bytes[ i ] = body[ i + offset ]; The memory is later free'd properly. We do not check that offset is sane. We do not need to malloc. Just use the offset in the array and we can dump the malloc/free plus eliminate a large number of copies. (void * ) ((char *) body + total + offset) The above is used in SerialImp.c writeArray to do that. The other is we never release the ByteArrayElements. This is done in Serialimp.c writeArray also. (*env)->ReleaseByteArrayElements( env, jbarray, body, 0 ); I suspect there are many fixes like this that need to be done for the ParallelImp.c. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 30 18:04:48 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 30 Dec 2007 20:04:48 -0500 Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: References: <4777B72C.2040900@red61.com> Message-ID: <47784030.40201@gatworks.com> > > I suspect there are many fixes like this that need to be done for the > ParallelImp.c. why stop there. for example: > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); what is troubling is the write() >= 0 return; If you are writing one byte, and the system has said that it wrote 0, why do u accept 0 bytes written as acceptable? I am also not too sure under what circumstances the (linux/unix) system will return 0 bytes written, instead of an error ( maybe under NON-BLOCKING i/o settings ). the same with: > #else > if( write( fd, bytes, count ) < 0 ) > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeArray" ); > #endif if write() does not return count, then there is also a failure to write *all* the data. From tjarvi at qbang.org Sun Dec 30 18:48:13 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 30 Dec 2007 18:48:13 -0700 (MST) Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: <47784030.40201@gatworks.com> References: <4777B72C.2040900@red61.com> <47784030.40201@gatworks.com> Message-ID: On Sun, 30 Dec 2007, U. George wrote: >> >> I suspect there are many fixes like this that need to be done for the >> ParallelImp.c. > > why stop there. > for example: >> JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, >> jobject jobj, jint ji ) >> { >> unsigned char byte = (unsigned char)ji; >> int fd = get_java_var( env, jobj,"fd","I" ); >> >> #ifdef WIN32 >> DWORD countWritten; /* Fixme, should be a loop until all is written >> */ >> if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), >> &countWritten, NULL ) < 0 ) return; >> #else >> if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; >> #endif >> throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > what is troubling is the write() >= 0 return; If you are writing one byte, > and the system has said that it wrote 0, why do u accept 0 bytes written as > acceptable? > I am also not too sure under what circumstances the (linux/unix) system will > return 0 bytes written, instead of an error ( maybe under NON-BLOCKING i/o > settings ). > > the same with: >> #else >> if( write( fd, bytes, count ) < 0 ) >> throw_java_exception_system_msg( env, IO_EXCEPTION, >> "writeArray" ); >> #endif > > if write() does not return count, then there is also a failure to write *all* > the data. > Agreed. I was just looking at possible causes of segv. The ParallelImp.c was initially a copy of the SerialImp.c back in ~1997. I hooked it up to a printer and sent "asdf." Shocked that it printed on Linux, I shipped it. Since then, there has been nominal interest in the w32 portion which has been encorperated. Maybe we should jump on irc one night and have fun cleaning it up. It could be fun. My fear with cleaning it up is people will start depending upon it and there is not enough interest in Parallel support to sustain itself. I've tried to be very clear about the state of that code. You don't have to read far in the code to find the following: It compiles and ParallelBlackBox runs. No further guarantees. Well... One.. it will print "Hello World!" on an epson DX 10 printer. you know.. the 10 character per second daisy wheel printer ;) - Trent Jarvi Unlike serial support, nobody is running tests for regressions that I know of. That's bad and good. We may break people but I'm not afraid of breaking them. It's truely a free for all with fixes. The main interest, as I understand, is supporting (legacy?) POS parallel port devices. I'm not sure this is realistic. If people are really going to do this, we need at least a hint that they have a test suite for what they need from the library. The second interest is supporting hobby devices that need to control 8 lines with basic on/off capability. LEDs for instance. That I would be interested in making work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Mon Dec 31 11:37:11 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 31 Dec 2007 13:37:11 -0500 Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: References: <4777B72C.2040900@red61.com> <47784030.40201@gatworks.com> Message-ID: <477936D7.2070605@gatworks.com> I > hooked it up to a printer and sent "asdf." Shocked that it printed on > Linux, I shipped it. Me too, I would have thought it'll go to the printer! :} > > My fear with cleaning it up is people will start depending upon it and > there is not enough interest in Parallel support to sustain itself. Ahh. Well on my epson photo printer, there is a parallel port, as well as a USB port. Soon the parallel cables will disappear in favor of USB. But you, nor I will know if the USB device on the printer will turn out to be a Serial Device, or a Parallel Device, or even a USB gizmo. Its up to the device driver built into the kernel to say one way or the other. Real serial port devices are disappearing. Real parallel port devices are also disappearing. Anyway, at this moment, I dont see SUN/JAVA getting back into the 'comm' business any time soon. Where are the 'people' to go? From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0031.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0029.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0029.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0028.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0026.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0026.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0025.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0024.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0024.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0024.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0024.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0024.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0023.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0046.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0023.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0047.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0023.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0023.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0023.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0022.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0022.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0022.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0022.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0022.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0021.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0019.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0019.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0019.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0016.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0014.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0013.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0012.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0012.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Mon Dec 24 05:45:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Mon, 24 Dec 2007 07:45:31 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: On 20-Dec-07, at 06:23 , Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! You should probably contact the Parallels developers to see if they have any suggestions. Andre From beat.arnet at gmail.com Tue Dec 25 14:30:48 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 25 Dec 2007 16:30:48 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() Message-ID: <47717688.20002@gmail.com> Hello all, It looks as if setSerialPortParams() is also setting DTR=true. In my application this is undesirable - is there anything that can be done to keep DTR==false while I reconfigure (the speed of) the port? I looked through the JAVA portion of gnu.io and could not find a single place where setDTR(true)is executed. I therefore suspect that DTR is affected by some lower-level (native) code.... Thanks for your help, Beat From tjarvi at qbang.org Tue Dec 25 17:02:59 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 17:02:59 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <47717688.20002@gmail.com> References: <47717688.20002@gmail.com> Message-ID: On Tue, 25 Dec 2007, Beat Arnet wrote: > Hello all, > It looks as if setSerialPortParams() is also setting DTR=true. In my > application this is undesirable - is there anything that can be done to > keep DTR==false while I reconfigure (the speed of) the port? I looked > through the JAVA portion of gnu.io and could not find a single place > where setDTR(true)is executed. I therefore suspect that DTR is affected > by some lower-level (native) code.... > > Thanks for your help, > Beat > The following in RXTXPort.java may help you. I was putting this code in several years ago and never really verified it. The idea is the call will open the port (DTR) will be asserted but after that, the port is 'preopened' meaning your later call to open with not assert the pin. NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX supports though. /** * Extension to CommAPI * This is an extension to CommAPI. It may not be supported on * all operating systems. * * Open the port and set DTR. remove lockfile and do not close * This is so some software can appear to set the DTR before 'opening' * the port a second time later on. * * @return true on success * @throws UnsupportedCommOperationException; * */ public static boolean staticSetDTR( String port, boolean flag ) throws UnsupportedCommOperationException { if ( debug ) z.reportln( "RXTXPort:staticSetDTR( " + port + " " + flag ); return( nativeStaticSetDTR( port, flag ) ); } -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Dec 25 18:36:54 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 18:36:54 -0700 (MST) Subject: [Rxtx] Configure.in update In-Reply-To: References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: On Sat, 22 Dec 2007, Andre-John Mas wrote: > Hi, > > I was just told there is a minor issue in the changes. Basically I was > overwriting any > LDFLAGS and CFLAGS that the user might have set, so the following diff > fixes this. > It is made relative to 1.35.2.76: This should be in CVS Tag commapi-0-0-1 now if you want to try it. Enable universal library builds for Mac OS X Andre-John Mas ajmas at sympatico.ca http://mailman.qbang.org/pipermail/rxtx/2007-December/1793319.ht ml -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Wed Dec 26 12:52:06 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Wed, 26 Dec 2007 14:52:06 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: References: <47717688.20002@gmail.com> Message-ID: <4772B0E6.2050803@gmail.com> Hello Trent, Thank you so much for the quick response! I have tried your suggestion, by calling staticSetDTR("COM1", false) before opening the port. Afterwards, I open the serial port and setDTR(true) followed by setDTR(false), which resets the target that I am attempting to program over RS-232. Then, I download the first portion of the code at a low transmission rate. After that, I need to reconfigure the port to run at a faster rate, for which I call setSerialPortParams() - unfortunately, even with the initial staticSetDTR call that you recommended, the setSerialPortParams() call still sets DTR=true, resulting in an unwanted reset of the target. Also, any subsequent call to staticSetDTR (after the port has been opened) results in the following error: Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The system cannot find the file specified. Am I using the staticSetDTR function as you intended and/or is there anything else that I should try? Regards, Beat Trent Jarvi wrote: > On Tue, 25 Dec 2007, Beat Arnet wrote: > >> Hello all, >> It looks as if setSerialPortParams() is also setting DTR=true. In my >> application this is undesirable - is there anything that can be done to >> keep DTR==false while I reconfigure (the speed of) the port? I looked >> through the JAVA portion of gnu.io and could not find a single place >> where setDTR(true)is executed. I therefore suspect that DTR is affected >> by some lower-level (native) code.... >> >> Thanks for your help, >> Beat >> > > The following in RXTXPort.java may help you. I was putting this code > in several years ago and never really verified it. The idea is the > call will open the port (DTR) will be asserted but after that, the > port is 'preopened' meaning your later call to open with not assert > the pin. > > NOTE: This is not part of CommAPI. I think it will work on the OS's > RXTX supports though. > > > /** > * Extension to CommAPI > * This is an extension to CommAPI. It may not be supported on > * all operating systems. > * > * Open the port and set DTR. remove lockfile and do not close > * This is so some software can appear to set the DTR before 'opening' > * the port a second time later on. > * > * @return true on success > * @throws UnsupportedCommOperationException; > * > */ > > public static boolean staticSetDTR( String port, boolean flag ) > throws UnsupportedCommOperationException > { > if ( debug ) > z.reportln( "RXTXPort:staticSetDTR( " + port + > " " + flag ); > return( nativeStaticSetDTR( port, flag ) ); > } > > -- > Trent Jarvi > tjarvi at qbang.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/101ad642/attachment-0007.html From rxtx at qbang.org Wed Dec 26 15:19:24 2007 From: rxtx at qbang.org (Doctor Claudette Gary) Date: Wed, 26 Dec 2007 15:19:24 -0700 Subject: [Rxtx] December 73% OFF Message-ID: <20071226-61924.19969.qmail@pool-71-160-100-227.lsanca.dsl-w.verizon.net> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/da5385e0/attachment-0007.html From tjarvi at qbang.org Wed Dec 26 17:48:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 26 Dec 2007 17:48:53 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <4772B0E6.2050803@gmail.com> References: <47717688.20002@gmail.com> <4772B0E6.2050803@gmail.com> Message-ID: staticSet* would be passed the filename ("COM1" for instance) even after opening the port. There may be another subtle bug there. As I mentioned that code was never tested. It looks like the problem with DTR asserting is in termios.c:tcsetattr() /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; This function is called towards the end of setSerialPortParams in SerialImp.c. The static version will do the same. The solution may be to just remove the code that tries to fiddle with DTR while trying to emulate the termios struct. One way to test the theory would be to try it out on a Linux/Mac/Solaris box since they don't go into termios.c. Presumably they would work. Taking out that DTR code might introduce an incompatability for existing code since some devices will not communicate until it is asserted. Not that we would not do it, but it is not a change without risk. On Wed, 26 Dec 2007, Beat Arnet wrote: > Hello Trent, > > Thank you so much for the quick response! > > I have tried your suggestion, by calling staticSetDTR("COM1", false) before > opening the port. > Afterwards, I open the serial port and setDTR(true) followed by > setDTR(false), which resets the target that I am attempting to program over > RS-232. Then, I download the first portion of the code at a low transmission > rate. After that, I need to reconfigure the port to run at a faster rate, for > which I call setSerialPortParams() - unfortunately, even with the initial > staticSetDTR call that you recommended, the setSerialPortParams() call still > sets DTR=true, resulting in an unwanted reset of the target. Also, any > subsequent call to staticSetDTR (after the port has been opened) results in > the following error: > > Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The > system cannot find the file specified. > > Am I using the staticSetDTR function as you intended and/or is there anything > else that I should try? > > Regards, > Beat > > Trent Jarvi wrote: >> On Tue, 25 Dec 2007, Beat Arnet wrote: >> >>> Hello all, >>> It looks as if setSerialPortParams() is also setting DTR=true. In my >>> application this is undesirable - is there anything that can be done to >>> keep DTR==false while I reconfigure (the speed of) the port? I looked >>> through the JAVA portion of gnu.io and could not find a single place >>> where setDTR(true)is executed. I therefore suspect that DTR is affected >>> by some lower-level (native) code.... >>> >>> Thanks for your help, >>> Beat >>> >> >> The following in RXTXPort.java may help you. I was putting this code in >> several years ago and never really verified it. The idea is the call will >> open the port (DTR) will be asserted but after that, the port is >> 'preopened' meaning your later call to open with not assert the pin. >> >> NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX >> supports though. >> >> >> /** >> * Extension to CommAPI >> * This is an extension to CommAPI. It may not be supported on >> * all operating systems. >> * >> * Open the port and set DTR. remove lockfile and do not close >> * This is so some software can appear to set the DTR before 'opening' >> * the port a second time later on. >> * >> * @return true on success >> * @throws UnsupportedCommOperationException; >> * >> */ >> >> public static boolean staticSetDTR( String port, boolean flag ) >> throws UnsupportedCommOperationException >> { >> if ( debug ) >> z.reportln( "RXTXPort:staticSetDTR( " + port + >> " " + flag ); >> return( nativeStaticSetDTR( port, flag ) ); >> } >> >> -- >> Trent Jarvi >> tjarvi at qbang.org >> > > From will.tatam at red61.com Sun Dec 30 08:20:12 2007 From: will.tatam at red61.com (Will Tatam) Date: Sun, 30 Dec 2007 15:20:12 +0000 Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: References: Message-ID: <4777B72C.2040900@red61.com> See also http://mailman.qbang.org/pipermail/rxtx/2007-November/1813769.html Will Gregory Dupriez wrote: > Hi everybody, > > I currently have some issue with the RXTX library version 2.1-7r2. > When I try to send to send some data to my parallel port, jvm crashes. > But it doesn't happen all the time. It seems to be dependant on the data. > > It seems to be the same issue that the one described on the mailing > list within this post > http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html > > I've put the report of the jvm crash at the end of my mail. > > It's quite an old issue but if somobody has solved the problem, it > will help me a lot. > I already try with different versions of the rxtx library and > different versions of the jvm but with the same result. > > In advance, thanks for your help. > > Regards, > > Gregory Dupriez > > # -- Will Tatam Systems Architect Red61 0845 867 2203 ext 103 From netbeans at gatworks.com Sun Dec 30 09:38:13 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 30 Dec 2007 11:38:13 -0500 Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: <4777B72C.2040900@red61.com> References: <4777B72C.2040900@red61.com> Message-ID: <4777C975.9020804@gatworks.com> Watt OS? Is that also true for the devel src's ? Will Tatam wrote: > See also > > http://mailman.qbang.org/pipermail/rxtx/2007-November/1813769.html > > Will > > Gregory Dupriez wrote: >> Hi everybody, From tjarvi at qbang.org Sun Dec 30 12:50:18 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 30 Dec 2007 12:50:18 -0700 (MST) Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: <4777B72C.2040900@red61.com> References: <4777B72C.2040900@red61.com> Message-ID: On Sun, 30 Dec 2007, Will Tatam wrote: > See also > > http://mailman.qbang.org/pipermail/rxtx/2007-November/1813769.html > > Will > > Gregory Dupriez wrote: >> Hi everybody, >> >> I currently have some issue with the RXTX library version 2.1-7r2. >> When I try to send to send some data to my parallel port, jvm crashes. >> But it doesn't happen all the time. It seems to be dependant on the data. >> >> It seems to be the same issue that the one described on the mailing >> list within this post >> http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html >> >> I've put the report of the jvm crash at the end of my mail. >> >> It's quite an old issue but if somobody has solved the problem, it >> will help me a lot. >> I already try with different versions of the rxtx library and >> different versions of the jvm but with the same result. >> >> In advance, thanks for your help. >> >> Regards, >> >> Gregory Dupriez >> >> # > > Parallel support needs a cleanup. We have been taking patches and including them but I do not know that this issue has been resolved. While looking at bugs like this, reproducability, sporatic nature, OS type and version all help form a picture of the type of problem. I see in the past that we have had a case in which the crash was reproducable by sending 8*N bytes. Is this reproducable for you in the same fassion? I see a couple odd things in the parallel write I would not do today. jbyte *body = (*env)->GetByteArrayElements( env, jbarray, 0 ); unsigned char *bytes = (unsigned char *)malloc( count ); int i; for( i = 0; i < count; i++ ) bytes[ i ] = body[ i + offset ]; The memory is later free'd properly. We do not check that offset is sane. We do not need to malloc. Just use the offset in the array and we can dump the malloc/free plus eliminate a large number of copies. (void * ) ((char *) body + total + offset) The above is used in SerialImp.c writeArray to do that. The other is we never release the ByteArrayElements. This is done in Serialimp.c writeArray also. (*env)->ReleaseByteArrayElements( env, jbarray, body, 0 ); I suspect there are many fixes like this that need to be done for the ParallelImp.c. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 30 18:04:48 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 30 Dec 2007 20:04:48 -0500 Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: References: <4777B72C.2040900@red61.com> Message-ID: <47784030.40201@gatworks.com> > > I suspect there are many fixes like this that need to be done for the > ParallelImp.c. why stop there. for example: > JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, > jobject jobj, jint ji ) > { > unsigned char byte = (unsigned char)ji; > int fd = get_java_var( env, jobj,"fd","I" ); > > #ifdef WIN32 > DWORD countWritten; /* Fixme, should be a loop until all is written */ > if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), &countWritten, NULL ) < 0 ) return; > #else > if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; > #endif > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); what is troubling is the write() >= 0 return; If you are writing one byte, and the system has said that it wrote 0, why do u accept 0 bytes written as acceptable? I am also not too sure under what circumstances the (linux/unix) system will return 0 bytes written, instead of an error ( maybe under NON-BLOCKING i/o settings ). the same with: > #else > if( write( fd, bytes, count ) < 0 ) > throw_java_exception_system_msg( env, IO_EXCEPTION, "writeArray" ); > #endif if write() does not return count, then there is also a failure to write *all* the data. From tjarvi at qbang.org Sun Dec 30 18:48:13 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 30 Dec 2007 18:48:13 -0700 (MST) Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: <47784030.40201@gatworks.com> References: <4777B72C.2040900@red61.com> <47784030.40201@gatworks.com> Message-ID: On Sun, 30 Dec 2007, U. George wrote: >> >> I suspect there are many fixes like this that need to be done for the >> ParallelImp.c. > > why stop there. > for example: >> JNIEXPORT void JNICALL LPRPort(writeByte)( JNIEnv *env, >> jobject jobj, jint ji ) >> { >> unsigned char byte = (unsigned char)ji; >> int fd = get_java_var( env, jobj,"fd","I" ); >> >> #ifdef WIN32 >> DWORD countWritten; /* Fixme, should be a loop until all is written >> */ >> if( WriteFile( (HANDLE)fd, &byte, sizeof( unsigned char ), >> &countWritten, NULL ) < 0 ) return; >> #else >> if( write( fd, &byte, sizeof( unsigned char ) ) >= 0 ) return; >> #endif >> throw_java_exception_system_msg( env, IO_EXCEPTION, "writeByte" ); > > what is troubling is the write() >= 0 return; If you are writing one byte, > and the system has said that it wrote 0, why do u accept 0 bytes written as > acceptable? > I am also not too sure under what circumstances the (linux/unix) system will > return 0 bytes written, instead of an error ( maybe under NON-BLOCKING i/o > settings ). > > the same with: >> #else >> if( write( fd, bytes, count ) < 0 ) >> throw_java_exception_system_msg( env, IO_EXCEPTION, >> "writeArray" ); >> #endif > > if write() does not return count, then there is also a failure to write *all* > the data. > Agreed. I was just looking at possible causes of segv. The ParallelImp.c was initially a copy of the SerialImp.c back in ~1997. I hooked it up to a printer and sent "asdf." Shocked that it printed on Linux, I shipped it. Since then, there has been nominal interest in the w32 portion which has been encorperated. Maybe we should jump on irc one night and have fun cleaning it up. It could be fun. My fear with cleaning it up is people will start depending upon it and there is not enough interest in Parallel support to sustain itself. I've tried to be very clear about the state of that code. You don't have to read far in the code to find the following: It compiles and ParallelBlackBox runs. No further guarantees. Well... One.. it will print "Hello World!" on an epson DX 10 printer. you know.. the 10 character per second daisy wheel printer ;) - Trent Jarvi Unlike serial support, nobody is running tests for regressions that I know of. That's bad and good. We may break people but I'm not afraid of breaking them. It's truely a free for all with fixes. The main interest, as I understand, is supporting (legacy?) POS parallel port devices. I'm not sure this is realistic. If people are really going to do this, we need at least a hint that they have a test suite for what they need from the library. The second interest is supporting hobby devices that need to control 8 lines with basic on/off capability. LEDs for instance. That I would be interested in making work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Mon Dec 31 11:37:11 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 31 Dec 2007 13:37:11 -0500 Subject: [Rxtx] Issue with RXTX library - Jvm crash In-Reply-To: References: <4777B72C.2040900@red61.com> <47784030.40201@gatworks.com> Message-ID: <477936D7.2070605@gatworks.com> I > hooked it up to a printer and sent "asdf." Shocked that it printed on > Linux, I shipped it. Me too, I would have thought it'll go to the printer! :} > > My fear with cleaning it up is people will start depending upon it and > there is not enough interest in Parallel support to sustain itself. Ahh. Well on my epson photo printer, there is a parallel port, as well as a USB port. Soon the parallel cables will disappear in favor of USB. But you, nor I will know if the USB device on the printer will turn out to be a Serial Device, or a Parallel Device, or even a USB gizmo. Its up to the device driver built into the kernel to say one way or the other. Real serial port devices are disappearing. Real parallel port devices are also disappearing. Anyway, at this moment, I dont see SUN/JAVA getting back into the 'comm' business any time soon. Where are the 'people' to go? From tophi at laposte.net Sat Dec 1 04:06:24 2007 From: tophi at laposte.net (Christophe GAILLARD) Date: Sat, 01 Dec 2007 12:06:24 +0100 Subject: [Rxtx] Fulll serial port name ... Message-ID: <47514030.80100@laposte.net> Hello all, Is there a way to have the full serial port name as it appear in peripheral managment (Windows). ex : Prolific USB-to-Serial Comm Port (COM3) I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full serial port name) Thanks, Christophe From tjarvi at qbang.org Sat Dec 1 12:06:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 12:06:53 -0700 (MST) Subject: [Rxtx] Fulll serial port name ... In-Reply-To: <47514030.80100@laposte.net> References: <47514030.80100@laposte.net> Message-ID: On Sat, 1 Dec 2007, Christophe GAILLARD wrote: > Hello all, > Is there a way to have the full serial port name as it appear in > peripheral managment (Windows). > ex : Prolific USB-to-Serial Comm Port (COM3) > I'm interesting to get "Prolific USB-to-Serial Comm Port" (the full > serial port name) Hi Christophe, That information is not provided by the fairly simple Serial API rxtx uses. That type of information is probably available through USB HID. JSR80 provides that API. As far as RXTX knows, your Serial device is soldered to your motherboard :) -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sat Dec 1 18:04:02 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 18:04:02 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4750A944.7010504@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: On Fri, 30 Nov 2007, U. George wrote: > U. George wrote: >> Box is a PIII laptop, with a USB 1 port. Device is a serialUSB device ( as >> per linux/redhat ) >> Debugging is not terribly easy on LINUX when there are pthreads > > The issue seems to be a mis-coordination of the "drain_loop" thread use of > the eis struct which is created from the "RXTXPort(eventLoop)" stack. > Once the flag eis.closing is set, the call to event loop is completed, and > the stack space is released ( re-used ). > unfortunately drain_loop still appears to be using the data, as the > pthread_kill() signal has yet to be processed by the drain_loop thread. > > The pthread_join() could be used here to wait for the drain_loop thread to > terminate. It might work if the pthread_detach() is *not* used, which > unfortunately is called by the thread creator as well as the thread itself :{ > It may be that the detach is not needed? When I put the pthread code into rxtx, I was just reading examples and trying to get it work. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sat Dec 1 19:11:36 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 01 Dec 2007 21:11:36 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> Message-ID: <47521458.2080908@gatworks.com> > > It may be that the detach is not needed? When I put the pthread code > into rxtx, I was just reading examples and trying to get it work. My issue is this statement in the code: > /* > Under normal conditions, SIGABRT will unblock tcdrain. However > a non-responding USB device combined with an unclean driver > may still block. This is very ugly because it may block the call > to close indefinetly. > */ With pthread_detach() the background task that is doing the tcdrain may hang, and the pthread_join() *wont* also deadlock because of the stuck thread. Because the struct eis is from the parent threads stack, u really cant release the stack that is in use by the parent thread via the return, as that would corrupt the eis struct, which is still in use by the child thread. In either case the com port device is stuck, and most likely not closeable, or reopenable anymore. It would be nice to be able to recover from this situation. But i dont think you will be able to do so. What would you like to do ? What is your preference? From tjarvi at qbang.org Sat Dec 1 19:47:31 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sat, 1 Dec 2007 19:47:31 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <47521458.2080908@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: On Sat, 1 Dec 2007, U. George wrote: > >> >> It may be that the detach is not needed? When I put the pthread code into >> rxtx, I was just reading examples and trying to get it work. > > My issue is this statement in the code: >> /* >> Under normal conditions, SIGABRT will unblock tcdrain. However >> a non-responding USB device combined with an unclean driver >> may still block. This is very ugly because it may block the call >> to close indefinetly. >> */ > > With pthread_detach() the background task that is doing the tcdrain may hang, > and the pthread_join() *wont* also deadlock because of the stuck thread. > Because the struct eis is from the parent threads stack, u really cant > release the stack that is in use by the parent thread via the return, as that > would corrupt the eis struct, which is still in use by the child thread. > > In either case the com port device is stuck, and most likely not closeable, > or reopenable anymore. It would be nice to be able to recover from this > situation. But i dont think you will be able to do so. > > What would you like to do ? What is your preference? > That comment suggests we may have good kernel drivers or hardware too. In the w32 world, bugs like this showed up all over the place and went away for the most part with new drivers. To me, this sounds like a kernel bug. Maybe we should contact someone like Greg K-H and see if the problem can't be resolved rather than worked around. I think he sheperds the USB drivers. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 2 05:52:33 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 02 Dec 2007 07:52:33 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> Message-ID: <4752AA91.2040205@gatworks.com> Trent Jarvi wrote: > On Sat, 1 Dec 2007, U. George wrote: > >> >>> >>> It may be that the detach is not needed? When I put the pthread code >>> into rxtx, I was just reading examples and trying to get it work. >> >> My issue is this statement in the code: >>> /* >>> Under normal conditions, SIGABRT will unblock tcdrain. However >>> a non-responding USB device combined with an unclean driver >>> may still block. This is very ugly because it may block the call >>> to close indefinetly. >>> */ >> >> With pthread_detach() the background task that is doing the tcdrain >> may hang, and the pthread_join() *wont* also deadlock because of the >> stuck thread. >> Because the struct eis is from the parent threads stack, u really cant >> release the stack that is in use by the parent thread via the return, >> as that would corrupt the eis struct, which is still in use by the >> child thread. >> >> In either case the com port device is stuck, and most likely not >> closeable, or reopenable anymore. It would be nice to be able to >> recover from this situation. But i dont think you will be able to do so. >> >> What would you like to do ? What is your preference? >> > > That comment suggests we may have good kernel drivers or hardware too. > In the w32 world, bugs like this showed up all over the place and went > away for the most part with new drivers. > > To me, this sounds like a kernel bug. Maybe we should contact someone > like Greg K-H and see if the problem can't be resolved rather than > worked around. I think he sheperds the USB drivers. Im not sure of your reply. As new USB drivers are developed, things will break. As new USB devices are created, new drivers will be developed, annd things will break again. As the works turns, things will break. At issue is how carefull, if at all, for such errant kernel coding designs. For instance, sometines the disk I/O does into an unrecoverable "D" state. That process has died wait state , and cannot be killed. There is nothing that an application programmer can do. The only thing that can be done is to shutdown the system, and reboot. Since the RXTX comment in your code appears to want to handle such USB driver errors, I'd like to know if your catastrophic device error/hang strategy is still of your concern? My strategy would be to believe that the system device calls will not hang. And if they did, post an eratta to the device driver developer. From zuran at pandora.be Sun Dec 2 07:10:08 2007 From: zuran at pandora.be (Danny Dom) Date: Sun, 2 Dec 2007 15:10:08 +0100 Subject: [Rxtx] examples Message-ID: <003301c834ed$0b950c30$a601a8c0@dannycomp> Hi, I am busy with a project for reading temperatures from an AVR controller. This works either by sending a command to the controller for reading a specific temperature. And also for reading the complete log of all temperature during 1 day. I have implemented the RXTX api, but as far as I see i am only using the standard comm part of the api. I want to make a secure communication, maybe using CRC 8, flow control .. I want to use buffering, and the eventlistener to notify when there is new data. But so far I did not find a proper example of all this, how to implement the listener at an nice OO way. anyone that can help me Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071202/5d539c0d/attachment-0032.html From tjarvi at qbang.org Sun Dec 2 09:37:35 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:37:35 -0700 (MST) Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: <4752AA91.2040205@gatworks.com> References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: On Sun, 2 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> On Sat, 1 Dec 2007, U. George wrote: >> >>> >>>> >>>> It may be that the detach is not needed? When I put the pthread code >>>> into rxtx, I was just reading examples and trying to get it work. >>> >>> My issue is this statement in the code: >>>> /* >>>> Under normal conditions, SIGABRT will unblock tcdrain. However >>>> a non-responding USB device combined with an unclean driver >>>> may still block. This is very ugly because it may block the call >>>> to close indefinetly. >>>> */ >>> >>> With pthread_detach() the background task that is doing the tcdrain may >>> hang, and the pthread_join() *wont* also deadlock because of the stuck >>> thread. >>> Because the struct eis is from the parent threads stack, u really cant >>> release the stack that is in use by the parent thread via the return, as >>> that would corrupt the eis struct, which is still in use by the child >>> thread. >>> >>> In either case the com port device is stuck, and most likely not >>> closeable, or reopenable anymore. It would be nice to be able to recover >>> from this situation. But i dont think you will be able to do so. >>> >>> What would you like to do ? What is your preference? >>> >> >> That comment suggests we may have good kernel drivers or hardware too. In >> the w32 world, bugs like this showed up all over the place and went away >> for the most part with new drivers. >> >> To me, this sounds like a kernel bug. Maybe we should contact someone like >> Greg K-H and see if the problem can't be resolved rather than worked >> around. I think he sheperds the USB drivers. > > Im not sure of your reply. > > As new USB drivers are developed, things will break. As new USB devices are > created, new drivers will be developed, annd things will break again. As the > works turns, things will break. > At issue is how carefull, if at all, for such errant kernel coding designs. > For instance, sometines the disk I/O does into an unrecoverable "D" state. > That process has died wait state , and cannot be killed. There is nothing > that an application programmer can do. The only thing that can be done is to > shutdown the system, and reboot. > > Since the RXTX comment in your code appears to want to handle such USB driver > errors, I'd like to know if your catastrophic device error/hang strategy is > still of your concern? > My strategy would be to believe that the system device calls will not hang. > And if they did, post an eratta to the device driver developer. > That is what I would do too. There is nothing to be gained from hiding serious issues. What I've usually done in the past is mention the issues we have noticed to the kernel developers at the Ottawa Linux Symposium. At times we do ignore unusual behavior but these are for unusual conditions. For instance, someone may be trying to use a Wii over bluetooth over usb over serial. If we can ignore conditions that are really the device going out of range and it does not cause other problems, we do put code in to help now and then. That said, USB-Serial was an unusual use case early on so there may be code that does not belone there anymore. -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Sun Dec 2 09:44:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 2 Dec 2007 09:44:20 -0700 (MST) Subject: [Rxtx] examples In-Reply-To: <003301c834ed$0b950c30$a601a8c0@dannycomp> References: <003301c834ed$0b950c30$a601a8c0@dannycomp> Message-ID: On Sun, 2 Dec 2007, Danny Dom wrote: > Hi, > > I am busy with a project for reading temperatures from an AVR controller. > > This works either by sending a command to the controller for reading a > specific temperature. And also for reading the complete log of all > temperature during 1 day. > > I have implemented the RXTX api, but as far as I see i am only using the > standard comm part of the api. > > I want to make a secure communication, maybe using CRC 8, flow control > .. I want to use buffering, and the eventlistener to notify when there > is new data. > > But so far I did not find a proper example of all this, how to implement > the listener at an nice OO way. > The examples we do have are on the rxtx wiki and in the source code under the contrib directory. http://rxtx.qbang.org/wiki/index.php/Examples You will find that rxtx does not do anything that could be done in another API. Buffering needs to be done with InputBufferStream from the JDK. CRC is not implemented as that could be used by multiple APIs. So I expect you would find the listener examples in contrib of some use. You may want to post some example code of your own on the wiki when you find everything you are after. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Tue Dec 4 14:56:39 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 16:56:39 -0500 Subject: [Rxtx] #undef TIOCSERGETLSR on LINUX In-Reply-To: References: <474ACFBE.5050406@gatworks.com> <474B8758.6010006@gatworks.com> <474D7831.5010300@gatworks.com> <4750A944.7010504@gatworks.com> <47521458.2080908@gatworks.com> <4752AA91.2040205@gatworks.com> Message-ID: <4755CD17.9080102@gatworks.com> > > That said, USB-Serial was an unusual use case early on so there may be > code that does not belone there anymore. > Attached is a diff of the changes I made that I think accomplishes both conditions: 1) drain_loop is SIGABRT'd and joined, if not stuck in device i/o wait. 2) If cannot do #1 ( ie device stuck ) within 10 seconds, then try canceling the thread ( which I hope destroys everything associated with the stuck thread ). Then join(). If join() waits, its bec the thread cannot be killed, and rest of task will probably die/stall soon thereafter. This works under linux ( with the #undef TIOCSERGETLSR ). Really need a device that gets stuck on demand to test out the thread cancel part. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071204/fc74e4af/attachment-0030.pl From alfonso.benot.morell at gmail.com Tue Dec 4 17:51:55 2007 From: alfonso.benot.morell at gmail.com (Alfonso Benot-Morell) Date: Wed, 5 Dec 2007 01:51:55 +0100 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events Message-ID: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Dear all, I have been testing the 'TwoWaySerialComm' example from the Documentation Wiki with a GPS device I must work with. When I just have to wait for one single response message from the device, that code works fine, but is unable to read any other message (in a row) from the device unless I type and send something in between. My program should be capable of reading messages from the device every X time (with X ranging from 0.1s to 1 hour). For this purpose, I slightly modified the code by implementing the SerialPortEventListener interface in the SerialReader nested class and setting notifyOnDataAvailable as true (then I had to pass a SerialPort object to the SerialReader constructor to add an event listener). After making some other modifications, my code remains as follows. --------------------------------------------------------------------------------------------------------------------------------------- import gnu.io.*; import java.util.*; import java.io.*; public class TwoWaySerialComm { public TwoWaySerialComm() { super(); } void connect ( String portName ) throws Exception { CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if ( portIdentifier.isCurrentlyOwned() ) { System.out.println("Error: Port is currently in use"); } else { CommPort commPort = portIdentifier.open(this.getClass ().getName(),20000); if ( commPort instanceof SerialPort ) { SerialPort serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(115200,SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE); serialPort.notifyOnDataAvailable(true); InputStream in = serialPort.getInputStream(); OutputStream out = serialPort.getOutputStream(); Thread th1 = new Thread(new SerialReader(in,serialPort)); Thread th2 = new Thread(new SerialWriter(out)); //th2.setPriority(Thread.MIN_PRIORITY); th1.start(); th2.start(); } else { System.out.println("Error: Only serial ports are handled by this example."); } } } /** */ public static class SerialReader implements Runnable, SerialPortEventListener { InputStream in; BufferedReader buff; int numVeces; public SerialReader ( InputStream in, SerialPort sp ) { numVeces=0; this.in = in; try { sp.addEventListener(this); buff = new BufferedReader(new InputStreamReader(in)); } catch (TooManyListenersException tmle) { System.out.println("Too many listeners exception"); tmle.printStackTrace(); } } public void run () { /*System.out.println("Dentro de run"); while(true); */ int i = 0; try { while(true) { /*System.out.println("Esperando en run " + i++); wait(); System.out.println("He vuelto de la int");*/ } } catch (Exception e) {} } public void serialEvent(SerialPortEvent e) { /*byte[] buffer = new byte[1024]; int len = -1; int i = 0;*/ try { System.out.println("Exception called"); String line = buff.readLine(); System.out.println("Line read"); System.out.println(line); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } /** */ public static class SerialWriter implements Runnable { //DataOutputStream dataOutput; OutputStream out; public SerialWriter(OutputStream Inout) { this.out = Inout; //dataOutput = new DataOutputStream(Inout); } public void run () { try { int c ; while ( ( c = System.in.read()) > -1 ) { this.out.write(c); System.out.println("Inside write loop"); } System.out.println("Outside write loop"); } catch ( IOException ioe ) { ioe.printStackTrace(); } } } public static void main ( String[] args ) { try { (new TwoWaySerialComm()).connect("COM2"); } catch ( Exception e ) { // TODO Auto-generated catch block e.printStackTrace(); } } } --------------------------------------------------------------------------------------------------------------------------------------- Unfortunately, it doesn't work properly either. After configuring the device so that it sends different kinds of messages (position, time and date,...) at different periods, no further reads are made, and I must exit the program (ctrl +c) and run it again if I want it to read the message row. When running the program for a second time (or even a third one), then it works fine and all the cyclic messages are correctly read and displayed but I don't understand why. I am aware it might have to do with the run() method in the SerialWriter nested class rather than with the performance of RXTX itself but I am a relatively new Java programmer and have run out of ideas. Please help! What modifications would you suggest for the code to work 100% properly ? Would it be better to write by events in the SerialWriter class? Thank you very much for your help and your time. Kind regards. Alfonso Benot-Morell -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/0832897e/attachment-0030.html From netbeans at gatworks.com Tue Dec 4 18:54:59 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 04 Dec 2007 20:54:59 -0500 Subject: [Rxtx] Modifying the 'TwoWaySerialComm' example to enable reading by events In-Reply-To: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> References: <7828521c0712041651h73ff021ha11c49b6f303558a@mail.gmail.com> Message-ID: <475604F3.6040601@gatworks.com> i think this is your issue: > System.out.println("Exception called"); > String line = buff.readLine(); > System.out.println("Line read"); > System.out.println(line); When you get a data avail notice, you really dont know if you got a full 'readline' of data - yet! I suppose if readline is incomplete ( ie no cr-lf ( or whatever )) your exception routine will deadlock, as no further events can be issued. It might be better if you just read whats *avail* on that event, and store/append it yourself ( stringbuffer? ) . When you get a full line, place that complete data in an arraylist ( or whatever ). subtract that data from the event stringbuffer. Notify someone that u got a full line. Then release the event. Don't cause a wait in your event handler. your event listener should have something like this: int len = this.in.read(buffer); if ( len > 0 ) System.out.print(new String(buffer,0,len)); return; There might also be an issue with readline concept of line termination is and that of the GPS itself. Alfonso Benot-Morell wrote: > Dear all, > > I have been testing the 'TwoWaySerialComm' example from the From lyon at docjava.com Wed Dec 5 05:44:02 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Wed, 05 Dec 2007 07:44:02 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: Hi All, Has anyone tried making use of RXTX on an Intel Mac with Java Webstart? Thanks! - Doug From ajmas at sympatico.ca Wed Dec 5 16:13:55 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 18:13:55 -0500 Subject: [Rxtx] Wiki updates Message-ID: <6bpls7$518pg4@toip6.srvr.bell.ca> Hi, I have just spent a bit of time updating the Wiki, with regards to installation. I have reworked the page, breaking things down a bit, though I cheated a little on the Linux and MS-Windows installation instructions, since I don't currently have access to them - I am using MacOS X. If someone has some time please could you make sure that the instructions are current, since they seemed a little dated. If you feel that anything else, in the additions I have made, can be improved, feel free to improve them. Andre From ajmas at sympatico.ca Wed Dec 5 19:15:01 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 5 Dec 2007 21:15:01 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: On 5-Dec-07, at 07:44 , Dr. Douglas Lyon wrote: > Hi All, > Has anyone tried making use of RXTX on an Intel Mac > with Java Webstart? Hi, I have never used it myself in this context, but the questions makes me tempted to try. Just need to learn how to sign the JAR first. Andre From equipoise1 at verizon.net Wed Dec 5 20:25:49 2007 From: equipoise1 at verizon.net (Bill Christens-Barry) Date: Wed, 05 Dec 2007 22:25:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? Message-ID: <47576BBD.1050703@verizon.net> I'm encountering a problem getting the example based on SimpleWrite.java to work (see http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter). The problem I'm having is exactly as described in the archives (see http://mailman.qbang.org/pipermail/rxtx/2006-October/1600464.html). Apparently, this problem has been solved by others, but I can't figure out what to do. I don't really understand the "lock" problem described in this thread, nor the resolution of it described in subsequent thread msgs. In particular, I don't know what the lock file name would be, where I would find it (I don't see any file in locations described in the thread msgs), and what I should do to correct the problem. Can anyone clue me with specific steps that might work under this version (Leopard) of Mac OS X? Thanks. Bill Christens-Barry From bschlining at gmail.com Wed Dec 5 23:26:05 2007 From: bschlining at gmail.com (Brian Schlining) Date: Wed, 5 Dec 2007 22:26:05 -0800 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: I use RXTX via web start on Mac; but so far only on PPC not intel. Why are you asking? > > > Has anyone tried making use of RXTX on an Intel Mac > > with Java Webstart? > > -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Brian Schlining -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071205/326bb942/attachment-0029.html From ajmas at sympatico.ca Thu Dec 6 06:41:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 6 Dec 2007 08:41:30 -0500 Subject: [Rxtx] Intel Mac and Webstart In-Reply-To: References: Message-ID: <03ADA435-5683-47DA-BEB4-5CC11D30B482@sympatico.ca> On 5-Dec-07, at 21:25 , Dr. Douglas Lyon wrote: > Hi Andre, > I think I might have gotten it to work (just now). > Would you like to try to beta test? > http://show.docjava.com:8086/book/cgij/code/jnlp/addbk.JAddressBook.Main.jnlp Looks like it works. Andre From Martin.Oberhuber at windriver.com Fri Dec 7 10:28:05 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Fri, 7 Dec 2007 18:28:05 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: Message-ID: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Hi Daniel, I've also seen issues with close and found the workaround that I sent to the RXTX mailing list on Oct 31: try { getSerialPort().removeEventListener(); Thread.sleep(50); //allow a little time for RXTX Native to catch up - makes stuff more stable } catch(Exception e) { Logger.logException(e); } getSerialPort().close(); You might also need the fixes that I've put into the CommPortIdentifier class, since the old code could hickup with multiple Threads and getPortIdentifier(). See http://bugzilla.qbang.org/show_bug.cgi?id=48 http://rxtx.qbang.org/eclipse/downloads Cheers, Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Daniel Wippermann Sent: Wednesday, November 28, 2007 4:47 PM To: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem Hi all, > I am struggling with an application that uses RXTX 2.1.7 and has been > working reliably in the past. When this program runs on a dual-core DELL > (Intel T2500), strange things happen with the RS232 communication. The > application is missing incoming characters and also often freezes when > trying to close the serial port. I highly suspect a threading problem > and was wondering if a) anybody had run into a similar problem with dual > core processors and b) if there is a list of does and dont's when it > comes to RXTX and threads. I just stumbled over the same "freeze" of the application while trying to "close()" the RXTXPort. In this rare circumstances the "IOLocked" variable of the RXTXPort class still has a value greater than 0 although no action is pending. That makes the close() method sleep forever in expectation of some other thread to end its work... I believe this is caused by the "IOLocked++" and "IOLocked--" instructions not being synchronized. I suspect that in a multi-core- CPU environment there is a chance that this instructions may interfere if two threads are operating on the same port, but in different CPU cores. In my example the monitor thread is reading the port, while the main thread, that opened the port, is writing to it. I just changed my application so that every port handling method call is done from within a synchronized method or block. I have not observed another freeze since then, although I did an extensive stress test. But I think it would be nice if you could do the synchronisation from within the library in a future release. Best regards, Daniel _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Fri Dec 7 10:57:56 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 12:57:56 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: Hello, I have followed Daniel's advice and encapsulated all access to the serial port using synchronized functions. However, I am a bit confused on how to deal with the serialEvent. Initially, I had only synchronized portions of the event handler where it accesses the InputStream. However, this caused dead-locks when trying to close the port while there were incoming characters. Now I have synchronized the function (synchronized void serialEvent) which eliminates the close dead-lock, but it looks as if the serialEvent does not attempt to acquire a lock and is capable of interrupting other synchronized statement in the same class. Do you have any recommendations on how to make the event handler thread-safe? Regards, Beat On Dec 7, 2007 12:28 PM, Oberhuber, Martin wrote: > Hi Daniel, > > I've also seen issues with close and found the > workaround that I sent to the RXTX mailing list > on Oct 31: > > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). > See > > http://bugzilla.qbang.org/show_bug.cgi?id=48 > > http://rxtx.qbang.org/eclipse/downloads > > Cheers, > Martin > > -----Original Message----- > From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf > Of Daniel Wippermann > Sent: Wednesday, November 28, 2007 4:47 PM > To: rxtx at qbang.org > Subject: Re: [Rxtx] Dual Core Problem > > Hi all, > > > I am struggling with an application that uses RXTX 2.1.7 and has been > > working reliably in the past. When this program runs on a dual-core > DELL > (Intel T2500), strange things happen with the RS232 > communication. > The > > application is missing incoming characters and also often freezes > when > trying to close the serial port. I highly suspect a threading > problem > and was wondering if a) anybody had run into a similar > problem with dual > core processors and b) if there is a list of does > and dont's when it > comes to RXTX and threads. > > I just stumbled over the same "freeze" of the application while trying > to "close()" the RXTXPort. In this rare circumstances the "IOLocked" > variable of the RXTXPort class still has a value greater than 0 although > no action is pending. That makes the close() method sleep forever in > expectation of some other thread to end its work... > > I believe this is caused by the "IOLocked++" and "IOLocked--" > instructions not being synchronized. I suspect that in a multi-core- CPU > environment there is a chance that this instructions may interfere if > two threads are operating on the same port, but in different CPU cores. > In my example the monitor thread is reading the port, while the main > thread, that opened the port, is writing to it. > > I just changed my application so that every port handling method call is > done from within a synchronized method or block. I have not observed > another freeze since then, although I did an extensive stress test. But > I think it would be nice if you could do the synchronisation from within > the library in a future release. > > Best regards, > Daniel > > _______________________________________________ > Rxtx mailing list > Rxtx 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/20071207/d52f0bec/attachment-0027.html From netbeans at gatworks.com Fri Dec 7 11:02:01 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:02:01 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47598A99.2010601@gatworks.com> > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up whats there to catch up? what that a patch for user code? or for RXTX ? From netbeans at gatworks.com Fri Dec 7 11:42:42 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 07 Dec 2007 13:42:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> Message-ID: <47599422.4020003@gatworks.com> u appear to be having a issue with programming in general. To avoid confusion, there should only one thread that is reading information from any 'serial' type of device. Having multiple threads reading the same serial ( or parallel, or USB ) does not work well, as each thread may obtain information that cannot be rewound back. Incomming chars, will be discarded on close. There shouldnt be a delay. SerialEvent will be passed to anyone that has added the serialevent interface. They will all be called by RXTX. If one thread wants to listen for a DSR then: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DSR: DataSetNowReady_routine(); } } If another thread want to know when data is avail: public void serialEvent(SerialPortEvent evt) { switch (evt.getEventType()) { case SerialPortEvent.DATA_AVAILABLE: { String s = read_in_the_data_routine(); Synchronized( arraylistofdatastrings ) { araylistofdataStrings.add(s); arraylistofdataStrings.notify(); } } } } or you can combine into one serialEvent routine. Somewhere in that same routine you have someone waiting for a string to appear in arraylistofdataStrings: Synchronized( arraylistofdataStrings ) { while( true ) { if ( arraylistofdataStrings.sizeof() == 0 ) { arraylistofdataStrings.wait( 1000 ); } else { s = arraylistofdataStrings.remove(0); break; } Beat Arnet wrote: > Hello, > I have followed Daniel's advice and encapsulated all access to the From beat.arnet at gmail.com Fri Dec 7 12:26:46 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Fri, 7 Dec 2007 14:26:46 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47599422.4020003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. Well, that's certainly what you get when electrical engineers like me write software ;) > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > But I am not talking about multiple threads reading from the same port. I am dealing with a case in which one thread is reading from the port, and another wants to close the port. > > Incomming chars, will be discarded on close. There shouldnt be a delay. > > SerialEvent will be passed to anyone that has added the serialevent > interface. They will all be called by RXTX. If one thread wants to > listen for a DSR then: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DSR: > DataSetNowReady_routine(); > } > } > > If another thread want to know when data is avail: > public void serialEvent(SerialPortEvent evt) { > > switch (evt.getEventType()) { > case SerialPortEvent.DATA_AVAILABLE: { > String s = read_in_the_data_routine(); > Synchronized( arraylistofdatastrings ) { > araylistofdataStrings.add(s); > arraylistofdataStrings.notify(); > } > } > } > } > > or you can combine into one serialEvent routine. > > > Somewhere in that same routine you have someone waiting for a string to > appear in arraylistofdataStrings: > > Synchronized( arraylistofdataStrings ) { > while( true ) { > if ( arraylistofdataStrings.sizeof() == 0 ) { > arraylistofdataStrings.wait( 1000 ); > } > else { > s = arraylistofdataStrings.remove(0); > break; > } > > Beat Arnet wrote: > > Hello, > > I have followed Daniel's advice and encapsulated all access to the > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071207/920ab071/attachment-0027.html From dwippermann at gmx.net Sat Dec 8 01:23:16 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sat, 8 Dec 2007 09:23:16 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <591F7B16-7DBA-4141-8D4F-11815A28A199@gmx.net> Hi all, > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. > That's true for my application as well and should be applicable to most apps that use event notification. The standard situation is that you have a GUI app that opens/closes the serial port in reaction to an UI event. Those actions would take place on the event dispatch thread. After opening the port you use addEventListener/notifyOnDataAvailable which starts a background monitor thread, which then calls your listener's implementation and hence reads the data. So you have one thread dedicated for reading (and all other events), but normally not reading from two different threads. So there should not be a problem... At least I thought so :) > try { > getSerialPort().removeEventListener(); > Thread.sleep(50); //allow a little time for RXTX Native to catch up > - makes stuff more stable > } catch(Exception e) { > Logger.logException(e); > } > getSerialPort().close(); > > You might also need the fixes that I've put into the > CommPortIdentifier class, since the old code could > hickup with multiple Threads and getPortIdentifier(). Thanks Martin, I'll look into that. But I'm still wondering why the IOLocked variable would retain a value not equal to 0 although all actions on the port have ended. The situations I debugged showed that the monitor thread was already terminated. Is the "Thread.sleep(50);" sufficient in all cases or are there any other means of determining whether the native part is ready to be closed? Thanks for your help, Daniel From ajmas at sympatico.ca Sat Dec 8 08:13:26 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 8 Dec 2007 10:13:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> Message-ID: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> On 7-Dec-07, at 14:26 , Beat Arnet wrote: > > On Dec 7, 2007 1:42 PM, U. George wrote: > u appear to be having a issue with programming in general. > > > Well, that's certainly what you get when electrical engineers like > me write software ;) > > > To avoid confusion, there should only one thread that is reading > information from any 'serial' type of device. Having multiple threads > reading the same serial ( or parallel, or USB ) does not work well, as > each thread may obtain information that cannot be rewound back. > > > But I am not talking about multiple threads reading from the same > port. I am dealing with a case in which one thread is reading from > the port, and another wants to close the port. If you can you should assign the responsibility of closing the port to the one handling the port. The other thread should simply be telling the handling thread that it should close the port. Threads are like people, in that if you give them conflicting instructions all hell breaks loose. For example of what I think you should do: class MyClass { private boolean continueReading = true; public void run() { InputStream in = null; try { in = createMyInputStream(); // or however int len = 0; byte[] buffer = new byte[1024]; while ( (len = in.read(buffer)) > 0 && continueReading ) { // handle the read data } } catch ( IOException ex ) { } finally { if ( in != null ) { in.close(); } } } } Andre From netbeans at gatworks.com Sat Dec 8 16:25:43 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 08 Dec 2007 18:25:43 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: <475B27F7.5040500@gatworks.com> >> But I am not talking about multiple threads reading from the same >> port. I am dealing with a case in which one thread is reading from the >> port, and another wants to close the port. > So I looked at the RXTX code ( close(), read() ) ( is that what u were trying to point out ? ) and it seems that a close() may not close. If there is heavy reading, then maybe close wont happen at all. Not sure why read is synchronized. If someone wants to read - uncoordinated, then that his option! But the read() and the close() does not appear to have a strong method of synchronization ( close should set a flag, that would cause any further I/O requests to throw an exception ). On would think that a close() would also prevent any further write() operations. But it does not. It also does not appear to wait for the write( b[] ) to complete ( in case the array has to be written out in chunks bec the kernel buffer is full. ) Does this help any? :-} From vorobyev.a at gmail.com Sun Dec 9 01:31:05 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sun, 09 Dec 2007 11:31:05 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475BA7C9.6090900@gmail.com> Good day. Following problem: Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 Java 6 - 1.6.02 OS OpenSuse 10.3, 2.6.22.13-0.3-default I have attach USB printer: Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device found, idVendor=088c, idProduct=2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: new device strings: Mfr=1, Product=2, SerialNumber=0 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Product: TTP 2030 Dec 8 09:25:46 linux-fceg kernel: usb 1-2: Manufacturer: Swecoin AB Dec 8 09:25:46 linux-fceg kernel: usb 1-2: configuration #1 chosen from 1 choice Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x088C pid 0x2030 Dec 8 09:25:46 linux-fceg kernel: usbcore: registered new interface driver usblp Dec 8 09:25:46 linux-fceg kernel: drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver linux-fceg:/var/log # ll /dev/usb* lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 Example: Enumeration portEnum = CommPortIdentifier.getPortIdentifiers(); while (portEnum.hasMoreElements()) { CommPortIdentifier portIdentifier = (CommPortIdentifier) portEnum.nextElement(); System.out.println(portIdentifier.getName() + " - " + getPortTypeName(portIdentifier.getPortType())); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial Virtual LPT port not found... Parallel port /dev/lp0 not foud also. After that i modified source RXTXCommDriver.java, registerScannedPorts if (osName.equals("Linux") { String[] temp = { "lp", // linux printer port "usblp" <====================== add this }; CandidatePortPrefixes = temp; } else if (osName.equals("FreeBSD")) { But /dev/usblp0 not found anyway. After that i modified registerValidPorts if (osName.equals("Solaris") || osName.equals("SunOS")) { checkSolaris(PortName, PortType); } else { if (PortType==CommPortIdentifier.PORT_PARALLEL) <<<< i.e. port type is parallel - don't execute testRead CommPortIdentifier.addPortName( PortName,PortType,this); <<<< else if (testRead(PortName, PortType)) CommPortIdentifier.addPortName( PortName,PortType,this); } result: /dev/ttyS2 - Serial /dev/ttyS1 - Serial /dev/ttyS0 - Serial /dev/usblp0 - Parallel /dev/lp0 - Parallel I think, what native testRead incorrectly defines presence of parallel port. I think that presence parallel port can be checked up so: int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) // port is not exist or it is not parallel port else // port is parallel! After that i execute program: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 5000); String str = "12313212312313121231321231231312"; port.getOutputStream().write(str.getBytes()); port.close(); Result: RXTXCommDriver:getCommPort(/dev/usblp0,2) LPRPort:LPRPort(/dev/usblp0) Port /dev/usblp0 in use by another application gnu.io.PortInUseException: Unknown Linux Application linux-fceg:/var/log # lsof | grep /dev/usb I.e. port is not use. Similar result at use /dev/lp0 How i can use parallel ports in my program? PS: Sorry for my english :) From tjarvi at qbang.org Sun Dec 9 00:03:51 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 00:03:51 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: On Sat, 8 Dec 2007, U. George wrote: >>> But I am not talking about multiple threads reading from the same >>> port. I am dealing with a case in which one thread is reading from the >>> port, and another wants to close the port. >> > So I looked at the RXTX code ( close(), read() ) ( is that what u were > trying to point out ? ) and it seems that a close() may not close. If > there is heavy reading, then maybe close wont happen at all. > > Not sure why read is synchronized. If someone wants to read - > uncoordinated, then that his option! > But the read() and the close() does not appear to have a strong method > of synchronization ( close should set a flag, that would cause any > further I/O requests to throw an exception ). > > On would think that a close() would also prevent any further write() > operations. But it does not. It also does not appear to wait for the > write( b[] ) to complete ( in case the array has to be written out in > chunks bec the kernel buffer is full. ) > Hi George, The code may not look conventional because I wasnt looking at other code at the time. It does do close to what you expect. The code got there the hard way though. close sets the fd to 0 which should throw exceptions if you try IO. while( IOLocked > 0 ) should delay close while reading and writing are in progress. In write(b[]) the following code can be found (comments added): // throw exception if closed. if ( fd == 0 ) throw new IOException(); // prevent closing while writing. IOLocked++; // Ensure the event thread is not being setup. ie // open() waitForTheNativeCodeSilly(); read() has the same logic (deleting some code for clairity) if ( fd == 0 ) throw new IOException(); IOLocked++; waitForTheNativeCodeSilly(); The close(): (for clairity just the code that we care about here:) while( IOLocked > 0 ) { sleep() } removeEventListener(); nativeClose( this.name ); fd = 0; -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 03:35:47 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 05:35:47 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475BA7C9.6090900@gmail.com> References: <475BA7C9.6090900@gmail.com> Message-ID: <475BC503.7010708@gatworks.com> > > linux-fceg:/var/log # ll /dev/usb* > lrwxrwxrwx 1 root root 7 Dec 9 08:56 /dev/usblp0 -> /dev/usb/lp0 I suppose this is your first issue i would have expected a /dev/usblp0 ->/dev/lp1 ( since most machines have a /dev/lp0 ) > > result: > /dev/ttyS2 - Serial > /dev/ttyS1 - Serial > /dev/ttyS0 - Serial > Virtual LPT port not found... Parallel port /dev/lp0 not foud also. thats bec lp0 its in /dev/usb ! > > LPRPort:LPRPort(/dev/usblp0) > Port /dev/usblp0 in use by another application > gnu.io.PortInUseException: Unknown Linux Application rxtx code: int fd = open( filename, O_RDWR | O_NONBLOCK ); rxtx appears to want to be able to open the device for reading AND writing. I suspect permission failure. 1) anyway have a symbolic pointer from /dev/usb/usblp0 to /dev/lp0 2) change permissions to be RW for you group or owner. From netbeans at gatworks.com Sun Dec 9 04:44:35 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 06:44:35 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <475BD523.3000900@gatworks.com> > close sets the fd to 0 which should throw exceptions if you try IO. Setting fd to 0 appears to be the last step in rxtx-close. It should be the first step, as a mutex to prevent any further I/O to the channel. With hyperthreads, quad cpu's, other threads can be simultaneously ( in real time ) executing reads & writes & other things. > > while( IOLocked > 0 ) should delay close while reading and writing are > in progress. Yes, but there is nothing there to prevent any further user I/O. You could have a bunch of threads continue to read & write, and keep IOLock > 0 for some time. Even if it did reach IOLock reached 0, there is still the possibility of some thread upping IOLock inbetween. > > In write(b[]) the following code can be found (comments added): > > // throw exception if closed. > if ( fd == 0 ) throw new IOException(); > // prevent closing while writing. Where is the "prevent further writing while closing" ? > > (for clairity just the code that we care about here:) > > while( IOLocked > 0 ) > { sleep() } this can take a long time to process. And defeats the purpose of a close() at time x. Because at time x+1, any further user requests to that file descriptor should have failed. One also has to ask why is the user program still reading or writing after having the close() called? But that is for the user to figure out. The orig question posed was to have a multi cpu, and 2 java threads. 1 thread was reading, while the other was ( attempting to ) closeing. probably something like this should be done: public close() { synchonize( eis ) { we_are_closing_up = true; while ( IOLock > 0 ) sleep( 100ms ); } native_close(); fd = 0; } we_are_closing_up = false; } public write() { if ( we_are_closing_up ) synchronize( eis ) { ; } if ( fd == 0 ) throw ( ..... IOLock++; ...... this is also not perfect. There is the possibility that a close could happen after the test, and before the IOLock++ From beat.arnet at gmail.com Sun Dec 9 05:44:23 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Sun, 09 Dec 2007 07:44:23 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475BE327.9010709@gmail.com> Thanks to all for responding to my original question! From what I hear, we now suspect that some improvements in RXTX might be necessary to make the code 100% thread safe. I would be happy to help, but I fear that I might not quite have the necessary training/skills. Maybe with some guidance I could give it a try. Since there has been no official release since 2.1.7, I am also wondering where I should start in the trunk so that I can be sure that all valid bug fixes that have been submitted sine 2.1.7 are included. However, I would also like to find out if there is something short-term that I can do in my application to avoid dead-locks on dual core machines, before RXTX is fixed. After Daniel's response, I synchronized all RXTXPort accesses, but I have still some crashes being reported from the field, albeit much less (and possibly unrelated?). Should I setup my code such that all accesses to the serial port happen in one unique thread? Would this prevent the problems that are described below? Any further guidance from the group would be appreciated. Regards, Beat U. George wrote: >> close sets the fd to 0 which should throw exceptions if you try IO. >> > Setting fd to 0 appears to be the last step in rxtx-close. It should be > the first step, as a mutex to prevent any further I/O to the channel. > With hyperthreads, quad cpu's, other threads can be simultaneously ( in > real time ) executing reads & writes & other things. > > > >> while( IOLocked > 0 ) should delay close while reading and writing are >> in progress. >> > Yes, but there is nothing there to prevent any further user I/O. You > could have a bunch of threads continue to read & write, and keep IOLock > > 0 for some time. > Even if it did reach IOLock reached 0, there is still the possibility of > some thread upping IOLock inbetween. > >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. >> > Where is the "prevent further writing while closing" ? > >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } >> > this can take a long time to process. And defeats the purpose of a > close() at time x. Because at time x+1, any further user requests to > that file descriptor should have failed. > One also has to ask why is the user program still reading or writing > after having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/6b16e64b/attachment-0026.html From tjarvi at qbang.org Sun Dec 9 11:01:00 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 11:01:00 -0700 (MST) Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BD523.3000900@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > >> close sets the fd to 0 which should throw exceptions if you try IO. > Setting fd to 0 appears to be the last step in rxtx-close. It should be the > first step, as a mutex to prevent any further I/O to the channel. With > hyperthreads, quad cpu's, other threads can be simultaneously ( in real time > ) executing reads & writes & other things. > > >> >> while( IOLocked > 0 ) should delay close while reading and writing are in >> progress. > Yes, but there is nothing there to prevent any further user I/O. You could > have a bunch of threads continue to read & write, and keep IOLock > 0 for > some time. > Even if it did reach IOLock reached 0, there is still the possibility of some > thread upping IOLock inbetween. >> >> In write(b[]) the following code can be found (comments added): >> >> // throw exception if closed. >> if ( fd == 0 ) throw new IOException(); >> // prevent closing while writing. > Where is the "prevent further writing while closing" ? >> >> (for clairity just the code that we care about here:) >> >> while( IOLocked > 0 ) >> { sleep() } > this can take a long time to process. And defeats the purpose of a close() at > time x. Because at time x+1, any further user requests to that file > descriptor should have failed. > One also has to ask why is the user program still reading or writing after > having the close() called? But that is for the user to figure out. > > > > The orig question posed was to have a multi cpu, and 2 java threads. 1 thread > was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could happen > after the test, and before the IOLock++ > There are two questions in the back of my mind. The first is I'd like to see some form of documentation in the Java API that says this is the right behavior. Anything from file IO to network sockets. The second is that we are dealing with perhaps the slowest reads and writes out there. I'd anticipate some downstream impact (incompatability) with people using the current implementation. At least at first, a change like this should be something people opt into via preferences or other means. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 12:17:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 14:17:15 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C3F3B.9050003@gatworks.com> > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. ?? I'm not sure what behavior your are expecting the JAVA docs to explain? I'd be more interested in the OS docs that will/could explain the interaction of threads and the sequencing of I/O operations amongst active cpu instruction pipelines. > > The second is that we are dealing with perhaps the slowest reads and > writes out there. I'd anticipate some downstream impact > (incompatability) with people using the current implementation. At > least at first, a change like this should be something people opt into > via preferences or other means. u mean there are folks that continue to read & write even though they also issued a (premature) close ? I am not aware of any OS that behaves like that. Or allows that. Yes, but if you will notice, the the speed of USB devices, that are made to behave like serial, or parallel devices, are very-very fast. A 500ms sleep is forever on some USB devices. BTW: Since JAVA source went public, sorta, did java publish the commapi source? BTW#2:Your mail to 'Rxtx' with the subject If not DEBUGing, remove useless calls to report() et al Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 46243 bytes with a limit of 40 KB From netbeans at gatworks.com Sun Dec 9 13:00:09 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 15:00:09 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> Message-ID: <475C4949.5060109@gatworks.com> > > There are two questions in the back of my mind. The first is I'd like > to see some form of documentation in the Java API that says this is the > right behavior. Anything from file IO to network sockets. from Class CommPort: After a communications port has been identified and opened it can be configured with the methods in the low-level classes like SerialPort and ParallelPort. Then an IO stream can be opend for reading and writing data. Once the application is done with the port, it must call the close method. Thereafter the application must not call any methods in the port object. Doing so will cause a java.lang.IllegalStateException to be thrown. From dwippermann at gmx.net Sun Dec 9 13:36:28 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:36:28 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> Message-ID: Hi all, > If you can you should assign the responsibility of closing the port > to the one > handling the port. The other thread should simply be telling the > handling thread > that it should close the port. Threads are like people, in that if > you give them > conflicting instructions all hell breaks loose. For example of what > I think you > should do: > yes, that you be the common way if I had full control over the thread. But the thread is implemented and started by RXTX, I only get event through my listener. How should the listener be able to close the port if no event is triggered? Can I wake up the RXTX thread to send a dummy event to trigger the close from inside the listener? Daniel From dwippermann at gmx.net Sun Dec 9 13:55:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Sun, 9 Dec 2007 21:55:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: And hi once more, > The orig question posed was to have a multi cpu, and 2 java threads. 1 > thread was reading, while the other was ( attempting to ) closeing. > > > probably something like this should be done: > > public close() { > synchonize( eis ) { > we_are_closing_up = true; > while ( IOLock > 0 ) > sleep( 100ms ); > } > native_close(); > fd = 0; > } > we_are_closing_up = false; > } > > public write() { > if ( we_are_closing_up ) > synchronize( eis ) { ; } > if ( fd == 0 ) throw ( ..... > IOLock++; > ...... > > > this is also not perfect. There is the possibility that a close could > happen after the test, and before the IOLock++ Thats the reason why I encapsulated all access in synchronized blocks using one mutex. You simply have no problem with "after ... , but before..." anymore :) One other problem I see is the use of the ++/-- operators on a variable that can be accessed by mutliple threads in parallel. I'll run a short test tomorrow on my office machine, but I assume that its read-modify-write behaviour might bring up a collision like: IOLocked = 100, both thread are running in different CPUs, but due to timing arrive at the "IOLocked--" nearly simultaneously CPU 1: reads variable to register => register = 100 CPU 2: doing something else -- CPU 1: decrements register => register = 99 CPU 2: reads variable to register => register = 100 -- CPU 1: writes register to variable => variable = 99 CPU 2: decrements register => register = 99 -- CPU 1: doing something else CPU 2: writes register to variable => variable = 99 It should have decremented twice, but it didn't... Thats a common situtation where locking is needed: modify the same variable from different threads without synchonization is hell :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/4bd9d474/attachment-0025.html From netbeans at gatworks.com Thu Dec 6 04:14:53 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 06 Dec 2007 06:14:53 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al Message-ID: <4757D9AD.2080305@gatworks.com> For the most part the report() calls from everywhere is usefull in debugging whats happening within rxtx. BUT if you are not debugging, then it is just wasted CPU cycles. That also includes the sprintf's sprinkled here and there. I placed the DEBUG code ( SerialImp.c ) under the #ifdef DEBUG . -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: a Url: http://mailman.qbang.org/pipermail/rxtx/attachments/20071206/92c448eb/attachment-0025.pl From tjarvi at qbang.org Sun Dec 9 19:15:44 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:15:44 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <4757D9AD.2080305@gatworks.com> References: <4757D9AD.2080305@gatworks.com> Message-ID: This looks OK to me George. Just two issues. make_message is probably copyrighted by the Free Software Foundation. It is probably easier to recode it than deal with the minor potential issues. The only other minor issue is that commenting out code isn't really better than deleting it in the long run. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 19:35:41 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 21:35:41 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> Message-ID: <475CA5FD.6050801@gatworks.com> Trent Jarvi wrote: > > This looks OK to me George. Just two issues. > > make_message is probably copyrighted by the Free Software Foundation. > It is probably easier to recode it than deal with the minor potential > issues. code u refer to is not used. I'm not too sure if "all" cc/libs can handle the particular var-args scheme. So if blows up, then that becomes an issue, but not harmfull for anybody's run. I did want to use it to do: REPORT("FIONREAD failed with error %s\n", strerror( errno )); or more recently REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); Since u PORT this to other machines, its not clear if var-args works everywhere the same way. u got any notion? > > The only other minor issue is that commenting out code isn't really > better than deleting it in the long run. > Sorta, sorta not. For short run ( in the heading of small changes ) it looks just like all the other items (historically) commented out, but not yet removed :) More things to clean up for the long run i guess. From tjarvi at qbang.org Sun Dec 9 19:47:37 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 19:47:37 -0700 (MST) Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: <475CA5FD.6050801@gatworks.com> References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > Trent Jarvi wrote: >> >> This looks OK to me George. Just two issues. >> >> make_message is probably copyrighted by the Free Software Foundation. It >> is probably easier to recode it than deal with the minor potential issues. > code u refer to is not used. I'm not too sure if "all" cc/libs can handle the > particular var-args scheme. So if blows up, then that becomes an issue, but > not harmfull for anybody's run. > > I did want to use it to do: > REPORT("FIONREAD failed with error %s\n", strerror( errno )); > > or more recently > > REPORT( "Failed to open device %s. error = %s\n", name, strerror( errno )); > > Since u PORT this to other machines, its not clear if var-args works > everywhere the same way. u got any notion? > >> >> The only other minor issue is that commenting out code isn't really better >> than deleting it in the long run. >> > Sorta, sorta not. For short run ( in the heading of small changes ) it looks > just like all the other items (historically) commented out, but not yet > removed :) More things to clean up for the long run i guess. > So far as I know, var-args works fine on the other platforms. See ioctl in termios.c (w32) for instance. I would rather link to make_message or implement a work alike. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 20:49:44 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 22:49:44 -0500 Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: References: Message-ID: <475CB758.6000508@gatworks.com> rxtx-bounces at qbang.org wrote: > Your mail to 'Rxtx' with the subject > > Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al > > Is being held until the list moderator can review it for approval. I suppose this limitation was a recent change? :/ From tjarvi at qbang.org Sun Dec 9 20:55:33 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Sun, 9 Dec 2007 20:55:33 -0700 (MST) Subject: [Rxtx] Your message to Rxtx awaits moderator approval In-Reply-To: <475CB758.6000508@gatworks.com> References: <475CB758.6000508@gatworks.com> Message-ID: On Sun, 9 Dec 2007, U. George wrote: > > rxtx-bounces at qbang.org wrote: >> Your mail to 'Rxtx' with the subject >> >> Re: [Rxtx] If not DEBUGing, remove useless calls to report() et al >> >> Is being held until the list moderator can review it for approval. > > > I suppose this limitation was a recent change? :/ > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > No. It is just a size limititation. I have upped it in the past. You might consider sending it as a .gz/.zip. Many people end up with full mailboxes and then bounce. The size limitation is 3 years old. The reason I don't get to the deffered email very often is it gets about 1k spams a week. At least we keep the spam out of everyones email box. If you like, I can fish out your email. I'd suggest zipping it though. There are ~500 people on the list but most just want to follow along. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Sun Dec 9 21:07:15 2007 From: netbeans at gatworks.com (U. George) Date: Sun, 09 Dec 2007 23:07:15 -0500 Subject: [Rxtx] If not DEBUGing, remove useless calls to report() et al In-Reply-To: References: <4757D9AD.2080305@gatworks.com> <475CA5FD.6050801@gatworks.com> Message-ID: <475CBB73.9080805@gatworks.com> > So far as I know, var-args works fine on the other platforms. See ioctl > in termios.c (w32) for instance. > dont have a win32 development system. At least not a recent one. And not installed anywhere :}} > I would rather link to make_message or implement a work alike. Its not a problem. looks almost like the jprint( ... ). -------------- next part -------------- A non-text attachment was scrubbed... Name: IfDef_patch.gz Type: application/x-gzip Size: 10381 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071209/5a6ec2c1/attachment-0025.gz From vorobyev.a at gmail.com Mon Dec 10 00:41:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 10:41:32 +0300 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? Message-ID: <475CEDAC.9090907@gmail.com> >2) change permissions to be RW for you group or owner. Thanks, it is my stupid mistake. But usb printer not work anyway. Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; ========================================== test program in c++: void ParallelPort::test(){ int status=0; if (ioctl(handle, LPGETSTATUS, &status)<0) return ; printf("status: 0x%02x\n",status); printf("Busy (~status & LP_PBUSY) : %x\n", (~status & LP_PBUSY)); printf("Error (~status & LP_PERRORP): %x\n", (~status & LP_PERRORP)); printf("Select (status & LP_PSELECD) : %x\n", (status & LP_PSELECD)); printf("Paper out (status & LP_POUTPA) : %x\n", (status & LP_POUTPA)); } result: status: 0x18 Busy (~status & LP_PBUSY) : 80 Error (~status & LP_PERRORP): 0 Select (status & LP_PSELECD) : 10 Paper out (status & LP_POUTPA) : 0 ParallelPort port("/dev/usblp0"); port.open(); port.write("Hello world"); port.write(0x1e); // cut port.close(); Result: Device print data and cut paper. ========================================== test program in java: CommPortIdentifier id = CommPortIdentifier.getPortIdentifier("/dev/usblp0"); ParallelPort port = (ParallelPort)id.open("iam", 50000); System.out.println("paper out: "+ port.isPaperOut()); System.out.println("buzy: "+ port.isPrinterBusy()); System.out.println("error: "+ port.isPrinterError()); System.out.println("select: "+ port.isPrinterSelected()); System.out.println("timeout: "+ port.isPrinterTimedOut()); result: paper out: true buzy: false error: false select: false timeout: false From netbeans at gatworks.com Sun Dec 9 22:04:46 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 00:04:46 -0500 Subject: [Rxtx] ParallelPort&RXTX - it works in Linux? In-Reply-To: <475CEDAC.9090907@gmail.com> References: <475CEDAC.9090907@gmail.com> Message-ID: <475CC8EE.9040205@gatworks.com> Alexander Vorobyev wrote: >> 2) change permissions to be RW for you group or owner. > Thanks, it is my stupid mistake. > > But usb printer not work anyway. > Similar problem in that that the status of port is defined incorrectly (probably usblp.c driver) and the library throw IOException; I suppose the USB/LP driver may not be sophisticated enough to provide that information, presuming that information is at all relevant to the device itself ( like a parallel port Zip Drive ). From vorobyev.a at gmail.com Mon Dec 10 01:46:32 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Mon, 10 Dec 2007 11:46:32 +0300 Subject: [Rxtx] One more question about usb->lpt Message-ID: <475CFCE8.3080807@gmail.com> Good day I wrote about the arisen problems at work with the device/dev/usb/lp0. At use c ++ work with the given device is made easily enough. Example void Usb2Lpt::open(){ handle = ::open(this->device.c_str(),O_RDWR|O_NOCTTY|O_NDELAY); if (handle<0) throw FileNotOpenException(strerror(errno)); } void Usb2Lpt::close(){ ::close(handle); handle = -1; } void Usb2Lpt::waitForRead(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, &rfds, NULL, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } void Usb2Lpt::waitForWrite(){ fd_set rfds; struct timeval tv; //------------------------------------------- if (mode==NON_BLOCK) return; //------------------------------------------- FD_ZERO(&rfds); FD_SET(handle, &rfds); tv.tv_sec = timeout/1000; tv.tv_usec = (timeout-tv.tv_sec*1000)*1000; //------------------------------------------- switch(select(handle+1, NULL, &rfds, NULL, &tv)){ case -1:{ throw IOException(std::string("select(handle+1, NULL, &rfds, NULL, &tv) failed.. Error: ")+strerror(errno)); break; } case 0:{ throw IOException("Timeout"); break; } default:{ break; } }; } unsigned char* Usb2Lpt::read(uint size){ .... r = ::read(handle,buf,len); ... return buf; } int Usb2Lpt::write(char data){ int w; waitForWrite(); w = ::write(handle,&data,sizeof(data)); if (w==-1){ if (errno==EAGAIN) return 0; else throw IOException(strerror(errno); } return w; } I.e. it is work as write/read + blocking/nonblocking mode; It is how much easy to make support of such driver in library rxtx? From zhouzhao58 at 163.com Mon Dec 10 05:13:14 2007 From: zhouzhao58 at 163.com (=?GBK?B?1tzuyA==?=) Date: Mon, 10 Dec 2007 20:13:14 +0800 (CST) Subject: [Rxtx] Help me ,please Message-ID: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> I used a common-user in the MAC OS 10.5. When i used rxtx 2.1.7 to open the serial port on the MAC OS 10.5.the rxtx has a error. how can I do ? thanks description: error testing lock file creation error details:permission deniedcheck_lock_status:no perminssion to create lock file. please see: how can I use lock files with rxtx ? in install -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/0ebc8026/attachment-0025.html From dwippermann at gmx.net Mon Dec 10 05:29:37 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 13:29:37 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Hi again, > One other problem I see is the use of the ++/-- operators on a > variable that can be accessed by mutliple threads in parallel. I'll > run a short test tomorrow on my office machine, but I assume that > its read-modify-write behaviour might bring up a collision like: > > IOLocked = 100, both thread are running in different CPUs, but due > to timing arrive at the "IOLocked--" nearly simultaneously > > CPU 1: reads variable to register => register = 100 > CPU 2: doing something else > -- > CPU 1: decrements register => register = 99 > CPU 2: reads variable to register => register = 100 > -- > CPU 1: writes register to variable => variable = 99 > CPU 2: decrements register => register = 99 > -- > CPU 1: doing something else > CPU 2: writes register to variable => variable = 99 > > It should have decremented twice, but it didn't... Thats a common > situtation where locking is needed: modify the same variable from > different threads without synchonization is hell :) Small sample app: (((snip))) public class Main { static Object mutex; static int counter; public static void concurrencyTest(final boolean useMutex) { Runnable r = new Runnable() { public void run() { synchronized(mutex) { try { mutex.wait(); } catch (Exception ex) { ex.printStackTrace(); } } for (int i = 0; i < 1000000; i++) { if (useMutex) { synchronized (mutex) { counter++; } } else { counter++; } } } }; try { counter = 0; mutex = new Object(); Thread t1 = new Thread(r); Thread t2 = new Thread(r); // start the two threads, they will wait for the mutex to be signaled t1.start(); t2.start(); // just a little sleep before the work Thread.sleep(100); synchronized (mutex) { // signal the two threads to start working mutex.notifyAll(); } t1.join(); t2.join(); System.out.println("useMutex = " + useMutex + " => counter = " + counter); } catch (Exception ex) { ex.printStackTrace(); } } public static void main(String[] args) { concurrencyTest(true); concurrencyTest(false); } } (((snip))) The program starts two threads. Each thread should increment a counter 1 million times, hence you expect a result of 2 million. Haven't tested it on a single-core machine, but on my multi-core office machine I get: useMutex = true => counter = 2000000 useMutex = false => counter = 1221835 The second result is fluctuating heavily. By that example I want to demonstrate that the use of "IOLocked++" for locking purposes is by far not thread-safe. And if you have heavy trafiic over the serial port (as I have, up to 2,8 MB of data to transceive at 115kbps), the chance of synchronization issues is reasonable. The only possibility I have to counter this at the moment is to synchronize all function calls to RXTX, especially close(), getInputStream(), read() as well as getOutputStream() and write(). It cannot be taken as a general advise to solve this problem, because synchronization has to fit into thr rest of your app. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/99aca116/attachment-0025.html From netbeans at gatworks.com Mon Dec 10 06:59:29 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 08:59:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D4641.7050001@gatworks.com> > By that example I want to demonstrate that the use of "IOLocked++" for > locking purposes is by far not thread-safe. And if you have heavy > trafiic over the serial port (as I have, up to 2,8 MB of data to > transceive at 115kbps), the chance of synchronization issues is reasonable. Synchronization of read/writes should be handled by the user. There is nothing in rxtx that will disturb the synchronization, as it is not an rxtx function. If a user wants to have 3 threads writing to that device, its up to the user to coordinate the proper sequencing of writes. The synchronize reads in SerialImp/read() appear to be a violation of the abstract class InputStream. If you want 3 threads simultaneously reading from that device, then thats up to the users application to determine the sequence for access. The IOLocked is a flag to indicate that a read/write I/O operation is in progress. it does not lockout the other from happening simultaneously. The synchronize read() does prevent simultaneous reads from multiple threads. The IOLocked indicator does prevent the close() from starting up, as close() waits for the IOLock value to become 0. The presumption is that the application's reads/writes will cease because the application has issued a close(). You wouldnt issue any further I/O after the close - would you? From dwippermann at gmx.net Mon Dec 10 07:53:03 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 15:53:03 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi all, > The IOLocked is a flag to indicate that a read/write I/O operation > is in > progress. it does not lockout the other from happening simultaneously. > The synchronize read() does prevent simultaneous reads from multiple > threads. > The IOLocked indicator does prevent the close() from starting up, as > close() waits for the IOLock value to become 0. The presumption is > that > the application's reads/writes will cease because the application has > issued a close(). You wouldnt issue any further I/O after the close - > would you? You are completely right, I never meant to imply something different. The IOLocked shall not lock concurrent reads or concurrents writes away, but be a signal for the close method that some read or write is still underway and it has to wait for them to finish. But the original question was, why the IOLocked variable has a value ! = 0 ALTHOUGH all read and write activities have ceased quite a while ago? And there were only two threads involved: on one side the thread that called open() and write() and on the other side the RXTX monitor thread that calling read(). No multiple reads or writes! Only a parallel write while reading. But that cannot be forbidden since we talk about an USART. Or am I wrong? Is there a problem to to have one read() and one write() run simulatenously? If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/db7e990f/attachment-0024.html From netbeans at gatworks.com Mon Dec 10 10:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 12:17:26 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <475D74A6.4000209@gatworks.com> > If that case is an allowed one, IOLocked has to be synchronized because it is altered in read() and write(). i suppose u mean that the IOLocked++, and the IOLocked-- has to be accomplished atomically ? I suppose besides meaning that you would also like that? :} From dwippermann at gmx.net Mon Dec 10 10:22:40 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:22:40 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: Hi everone, > Hi all, >> The IOLocked is a flag to indicate that a read/write I/O operation >> is in >> progress. it does not lockout the other from happening >> simultaneously. >> The synchronize read() does prevent simultaneous reads from multiple >> threads. >> The IOLocked indicator does prevent the close() from starting up, as >> close() waits for the IOLock value to become 0. The presumption is >> that >> the application's reads/writes will cease because the application has >> issued a close(). You wouldnt issue any further I/O after the close - >> would you? > You are completely right, I never meant to imply something > different. The IOLocked shall not lock concurrent reads or > concurrents writes away, but be a signal for the close method that > some read or write is still underway and it has to wait for them to > finish. > But the original question was, why the IOLocked variable has a > value != 0 ALTHOUGH all read and write activities have ceased quite > a while ago? And there were only two threads involved: on one side > the thread that called open() and write() and on the other side the > RXTX monitor thread that calling read(). No multiple reads or > writes! Only a parallel write while reading. But that cannot be > forbidden since we talk about an USART. Or am I wrong? Is there a > problem to to have one read() and one write() run simulatenously? > If that case is an allowed one, IOLocked has to be synchronized > because it is altered in read() and write(). I've prepared a patch to RXTXPort.java to help me outline my point of view in this discussion. It's attached to this posting. In general, three things have been done: 1) A new variable "IOLockedMutex" is introduced. It's only purpose is to be passed as a parameter to the synchronized statement. 2) Every "IOLocked++" is encapsulated by that said synchronized block 3) In some methods there were multiple "IOLocked--". Those have all been substituted by a one synchronized "IOLocked--" which is processed in a "finally" statement that handles all exceptions from right after "IOLocked++" till the end of the method. So every occurence or variation of the sequence: > IOLocked++; > waitForTheNativeCodeSilly(); > try { > // something method specific here > } catch (IOException ex) { > IOLocked--; > throw ex; > } > IOLocked--; has been replaced by: > synchronized (IOLockedMutex) { > IOLocked++; > } > try { > waitForTheNativeCodeSilly(); > // something method specific here > } finally { > synchronized (IOLockedMutex) { > IOLocked--; > } > } In my opinion that chance has no impact on the surrounding application. It wont block away one function call if another one is running, it only ensures, that only one thread alters the IOLocked variable at any given time. So you could have one polling read() and one write() action in parallel without interference. In the hope, that I haven't abused your patience too much :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0048.html -------------- next part -------------- A non-text attachment was scrubbed... Name: RXTXPort_IOLockedMutex.diff Type: application/octet-stream Size: 6297 bytes Desc: not available Url : http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0024.obj -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/100c8240/attachment-0049.html From dwippermann at gmx.net Mon Dec 10 10:44:17 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 18:44:17 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> Message-ID: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Hi! > i suppose u mean that the IOLocked++, and the IOLocked-- has to be > accomplished atomically ? > > I suppose besides meaning that you would also like that? :} Yes, indeed... I was lacking the word "atomically", but at least you were able to follow my remaining semi-english explanation :) Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/5f88033d/attachment-0024.html From netbeans at gatworks.com Mon Dec 10 14:03:38 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 16:03:38 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DA9AA.90106@gatworks.com> According to this (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): > A write to a volatile field happens-before every subsequent read of that same field. Writes and reads of volatile fields have similar memory consistency effects as entering and exiting monitors, but do not entail mutual exclusion locking. It appears that "volatile" makes concurrent updates atomic. Its not intuitive. So is it true ? Daniel Wippermann wrote: > Hi! > >> i suppose u mean that the IOLocked++, and the IOLocked-- has to be >> accomplished atomically ? >> >> I suppose besides meaning that you would also like that? :} > Yes, indeed... I was lacking the word "atomically", but at least you > were able to follow my remaining semi-english explanation :) > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From dwippermann at gmx.net Mon Dec 10 14:33:02 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Mon, 10 Dec 2007 22:33:02 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: Hi, > According to this > (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html > ): > > A write to a volatile field happens-before every subsequent read > of that same field. Writes and reads of volatile fields have similar > memory consistency effects as entering and exiting monitors, but do > not entail mutual exclusion locking. > > It appears that "volatile" makes concurrent updates atomic. Its not > intuitive. So is it true ? > I tried the volatile declaration on my small ConcurrencyTest app. It has no effect, the unsynchronized version still misses a vast amount of increments. I think that the read-modify-write behaviour of "++" and "--" is not covered by the "happens-before" clause of the volatile declaration. It only ensures, that the corresponding read and write operations are not interrupted, the time in between these operations is not covered. Although it sounded promising on the first look... I can't imagine a different working approach to get IOLocked thread- safe at the moment. But perhaps I'm stuck and just have to think about it another night or two... Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071210/d13a0db5/attachment-0024.html From netbeans at gatworks.com Mon Dec 10 15:32:42 2007 From: netbeans at gatworks.com (U. George) Date: Mon, 10 Dec 2007 17:32:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <475DBE8A.8050408@gatworks.com> I suspect that what they said is not exact. My impression, at one time, was that the volatile object could not be optimized into not writing to memory. Oh well. Have you tried java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? from jdk1.5 and beyond? these set of utilities have an interesting way of 'atomically' incrementing the variable. I'd be curious if your test would also fail using these utilities. Daniel Wippermann wrote: > Hi, > >> According to this >> (http://java.sun.com/javase/6/docs/api/java/util/concurrent/package-summary.html): >> >/ A write to a volatile field happens-before every subsequent read of >> that same field. Writes and reads of volatile fields have similar >> memory consistency effects as entering and exiting monitors, but do >> not entail mutual exclusion locking. / It appears that "volatile" >> makes concurrent updates atomic. Its not intuitive. So is it true ? > > > I tried the volatile declaration on my small ConcurrencyTest app. It has > no effect, the unsynchronized version still misses a vast amount of > increments. > > I think that the read-modify-write behaviour of "++" and "--" is not > covered by the "happens-before" clause of the volatile declaration. It > only ensures, that the corresponding read and write operations are not > interrupted, the time in between these operations is not covered. > Although it sounded promising on the first look... > > I can't imagine a different working approach to get IOLocked thread-safe > at the moment. But perhaps I'm stuck and just have to think about it > another night or two... > > Daniel > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From zhanglong at adventnet.com.cn Mon Dec 10 19:22:23 2007 From: zhanglong at adventnet.com.cn (zl) Date: Tue, 11 Dec 2007 10:22:23 +0800 Subject: [Rxtx] Homestay 2008 Beijing Olympic Message-ID: <475DF45F.5030702@adventnet.com.cn> Do you want to come to Beijing for 2008 Olympic? Please choose homestay for your accommodation and select my home. Introduction: The whole apartment is furnished in traditional Chinese Style. All furniture is brand new. There are two bedrooms, a modern kitchen, a living room, one bathrooms and one storageroom. It has all the gadgets and amenities including ADSL internet connection, on-demand cable, washer, fridge, microwave, a 25 inch television set, home security system.And community body guard is also included. 24 hours hot water services, local banking facilities,air conditioners are available. Everything is comfortable for living, also supermarket(Carrefour is 5 minuters), park, school, restaurants, entertainment places is surrounding. It's about 10 minutes' drive to the National Stadium (the Bird Nest), and no longer than 5 minutes' walk to the Olympics Forest Park. The subway line 13 and 5 's station of Lishuiqiao is 5-10 minutes' walking distance. For more detail and pictures,Please look at: http://picasaweb.google.com/zlong6688/HomestayBeijing2008 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249599243132994 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096249629307904114 http://picasaweb.google.com/zlong6688/HomestayBeijing2008/photo?authkey=pI8IGdSnAqM#5096615126729827426 Contact me: E-mail: zhanglong at adventnet.com.cn Mobile: 13241969320 MSN:zlong6666 at hotmail.com PS: Please help me tell this message to your friends. And you can post this message with no limit. (End) ------------------------------------------------- From dwippermann at gmx.net Mon Dec 10 22:02:59 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 06:02:59 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> Message-ID: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Hi, > I suspect that what they said is not exact. My impression, at one > time, > was that the volatile object could not be optimized into not writing > to > memory. Oh well. > > Have you tried > java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > from jdk1.5 and beyond? > > these set of utilities have an interesting way of 'atomically' > incrementing the variable. I'd be curious if your test would also fail > using these utilities. thanks for that hint, an interesting package :) This class works as expected and is way faster (at least on my machine) that synchronizing the increment manually. The only drawback - as you mentioned before - is that it requires Java5 to run... And as far as I understand, RXTX targets 1.3 and later JREs... But an eyecatcher indeed, thanks again. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/376692e5/attachment-0024.html From netbeans at gatworks.com Tue Dec 11 05:28:29 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 07:28:29 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <475E826D.40609@gatworks.com> u didnt catch it all. although introduced in 1.5, those same folks ( not sun ) who made that stuff public domain, also created a 1.4 version, and a 1.3 version. Those backward compatable routines are 'synchronize'd, so should run no better that what rxtx is currently doing. BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx synchronize directives be completely removed from reads and writes ( as well as the removal of IOLocked et al ) ? Daniel Wippermann wrote: > Hi, > >> I suspect that what they said is not exact. My impression, at one time, >> was that the volatile object could not be optimized into not writing to >> memory. Oh well. >> >> Have you tried >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? >> from jdk1.5 and beyond? >> >> these set of utilities have an interesting way of 'atomically' >> incrementing the variable. I'd be curious if your test would also fail >> using these utilities. > > thanks for that hint, an interesting package :) > > This class works as expected and is way faster (at least on my machine) > that synchronizing the increment manually. > > The only drawback - as you mentioned before - is that it requires Java5 > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > But an eyecatcher indeed, thanks again. > > Daniel > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From beat.arnet at gmail.com Tue Dec 11 08:48:41 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 11 Dec 2007 10:48:41 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475E826D.40609@gatworks.com> References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <475E826D.40609@gatworks.com> Message-ID: I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat On Dec 11, 2007 7:28 AM, U. George wrote: > u didnt catch it all. although introduced in 1.5, those same folks ( not > sun ) who made that stuff public domain, also created a 1.4 version, and > a 1.3 version. Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. > > > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes ( as > well as the removal of IOLocked et al ) ? > > Daniel Wippermann wrote: > > Hi, > > > >> I suspect that what they said is not exact. My impression, at one time, > >> was that the volatile object could not be optimized into not writing to > >> memory. Oh well. > >> > >> Have you tried > >> java.util.concurrent.atomic.AtomicInteger.getAndIncrement() ? > >> from jdk1.5 and beyond? > >> > >> these set of utilities have an interesting way of 'atomically' > >> incrementing the variable. I'd be curious if your test would also fail > >> using these utilities. > > > > thanks for that hint, an interesting package :) > > > > This class works as expected and is way faster (at least on my machine) > > that synchronizing the increment manually. > > > > The only drawback - as you mentioned before - is that it requires Java5 > > to run... And as far as I understand, RXTX targets 1.3 and later JREs... > > > > But an eyecatcher indeed, thanks again. > > > > Daniel > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Rxtx mailing list > > Rxtx 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/20071211/356ff730/attachment-0023.html From dwippermann at gmx.net Tue Dec 11 08:50:07 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 16:50:07 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> Message-ID: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Hi all, > Those backward compatable routines are 'synchronize'd, so > should run no better that what rxtx is currently doing. Why do you think so? All write() methods in the SerialOutputStream class are not synchronized at all at the moment. And the "synchronized" read() methods only forbid to call more than one of them at any given time because they lock the SerialInputStream object they are living in. But they have no locking influence on a concurrent write() and its altering of IOLocked. So rxtx would do much better than what it is currently doing. > BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx > synchronize directives be completely removed from reads and writes > ( as > well as the removal of IOLocked et al ) ? That's not my decision to make, it's more a political question whether the library takes care of it or the end user developer. You can of course remove it all and let the user take care of it... If you ask me personally: I believe it makes perfect sense to do it in the library. The speed impact is marginal. But it touches the integrity of the library state (since IOLocked cannot be influenced directly from outside). If you cannot close the port because an internal variable's content is damaged, that is nothing to be handled by the end user dev. From my point of view it's the library's responsibility. But I'm tired of "defending" my position here. If you think, it is ok how it is done at the moment: fine, let's end that discussion here. That's the advantage of open source and an open mind: just branch, patch and continue :) On a small side note I'd like to thank Trent, Martin and all the other contributors of this project. It's damn good lib and saved me a lot of time in the past. Keep up the good work, guys! Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/78331b1d/attachment-0023.html From Steffen.DETTMER at ingenico.com Tue Dec 11 09:26:30 2007 From: Steffen.DETTMER at ingenico.com (Steffen DETTMER) Date: Tue, 11 Dec 2007 17:26:30 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <20071211162630.GI2253@elberon.bln.de.ingenico.com> * Daniel Wippermann wrote on Tue, Dec 11, 2007 at 16:50 +0100: > > BTW: wouldnt all run a whole lot better ( faster anyway ) if > > the rxtx synchronize directives be completely removed from > > reads and writes ( as well as the removal of IOLocked et al) ? > > If you ask me personally: I believe it makes perfect sense to > do it in the library. The speed impact is marginal. But it > touches the integrity of the library state (since IOLocked > cannot be influenced directly from outside). I agree. The alternative would be to require that each using application needs to serialise any call to lib functions. In Java usually multiple threads are very common, so I think its likely that all applications would need to add some locking around. I'm afraid it would be uncomfortable, difficult and `risky' to use then (and if not locked correctly, strange behavior could happen later on, after tests, and so on... personally I really hate such problems because they are hard to find, so best is to avoid them I think :)). So I think, having (or keeping, with some extensions / fixes) this `threadsafety' as a lib feature keeps rxtx easily usable and everyone would benefit :) > On a small side note I'd like to thank Trent, Martin and all > the other contributors of this project. It's damn good lib and > saved me a lot of time in the past. Keep up the good work, > guys! well said, again I agree! :) Yes, thanks a lot guys!! oki, Steffen About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. About Ingenico Throughout the world businesses rely on Ingenico for secure and expedient electronic transaction acceptance. Ingenico products leverage proven technology, established standards and unparalleled ergonomics to provide optimal reliability, versatility and usability. This comprehensive range of products is complemented by a global array of services and partnerships, enabling businesses in a number of vertical sectors to accept transactions anywhere their business takes them. www.ingenico.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. From Martin.Oberhuber at windriver.com Tue Dec 11 09:40:45 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:40:45 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: References: <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net><6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net><695CE8C6-D794-464A-9550-150C1501A09F@gmx.net><475E826D.40609@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B0F@ism-mail03.corp.ad.wrs.com> Hi all, I haven't had time to follow this thread in too much detail, but Daniel's argument as well as his patch make perfectly sense to me. The modifications he made seem to be required to ensure data integrity in a multi-threaded enviroment, and his methods (add an additional mutex, use try...finally) seem perfectly right to me: ensuring data integrity, without changing any other semantics of the existing implementation (especially read/write concurrency on a higher level). I also agree that data integrity needs to be maintained at the library level, and not offloaded to the client by not using synchronized at all. I can't understand why these modifications should make RXTXPort a lot slower. On modern JVM's, the "synchronized" statement is processed real fast. Beat can you give more background about your measurements? Daniel: thanks for your contributions and your perseverance. Please don't give up and create your own branch of RXTX. We need guys like you in our Open Source Community :-) Thanks Martin ________________________________ From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of Beat Arnet Sent: Tuesday, December 11, 2007 4:49 PM To: U. George Cc: rxtx at qbang.org Subject: Re: [Rxtx] Dual Core Problem I confirmed Daniel's theory by running his example on both a dual-core and single-core machine. Both counter results are identical on a single core machine, and differ on dual cores. I then tried the synchronized and concurrent.atomic approach and noticed that they both make RXTXPort unbearably slow. Thanks for all your help! Beat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/6333f1fa/attachment-0023.html From netbeans at gatworks.com Tue Dec 11 09:44:24 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 11:44:24 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <475EBE68.8030606@gatworks.com> Daniel Wippermann wrote: > Hi all, > >> Those backward compatable routines are 'synchronize'd, so >> should run no better that what rxtx is currently doing. > > Why do you think so? All write() methods in the SerialOutputStream class > are not synchronized at all at the moment. And the "synchronized" read() > methods only forbid to call more than one of them at any given time > because they lock the SerialInputStream object they are living in. But > they have no locking influence on a concurrent write() and its altering > of IOLocked. So rxtx would do much better than what it is currently doing. Because, if you were to use the (AtomicInteger) IOLocked.getAndIncrement(); u would get a hotspot/native operation in JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible routines, you would get the synchronise'd routine for getAndIncrement. the JDK1.3 backward routine would be just as good as your suggested code: synchronize( oIOLocked ) { IOLocked++; } > >> BTW: wouldnt all run a whole lot better ( faster anyway ) if the rxtx >> synchronize directives be completely removed from reads and writes ( as >> well as the removal of IOLocked et al ) ? > > That's not my decision to make, it's more a political question whether > the library takes care of it or the end user developer. You can of > course remove it all and let the user take care of it... For some its what the docs say ( or suggest anyway ) > > If you ask me personally: I believe it makes perfect sense to do it in > the library. The speed impact is marginal. But it touches the integrity > of the library state (since IOLocked cannot be influenced directly from > outside). If you cannot close the port because an internal variable's > content is damaged, that is nothing to be handled by the end user dev. > From my point of view it's the library's responsibility. The point being is that IOLocked is not necessary for the integrity or the state of the library. Nor is the ( forced upon you ) synchronized reads. thats an IMHO. > > But I'm tired of "defending" my position here. If you think, it is ok > how it is done at the moment: I'm not sure what u mean? For my USB/serial io device, rxtx spins & spins. So its not OK at the moment. When I remove (unplug) the serial device, it also spins and spins. Also not an OK situation. And I really hate it when a close() refuses to do so! fine, let's end that discussion here. I thought we were addressing bugs. From Martin.Oberhuber at windriver.com Tue Dec 11 09:48:38 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 17:48:38 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475C3F3B.9050003@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> U.George wrote: BTW: Since JAVA source went public, sorta, did java publish the commapi source? Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" for SOME files only, see the last paragraph of following link): http://openjdk.java.net/legal/gplv2+ce.html whereas RXTX is under (modified) LGPL. Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. That would be a BIG problem at least for some companies using RXTX. GPL is viral in that it might force companies open-source their proprietary stuff if they link against a GPL'd lib! LGPL is not that viral, at least not when linking dynamically. We'd really have a problem when RXTX is infected with GPL'd code fragments. Therefore, please DONT even try finding the GPL'd Sun code, read it or reference it otherwise. It's really a big threat. Really. Thanks, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:04:20 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:04:20 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475BE327.9010709@gmail.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <475BD523.3000900@gatworks.com> <475BE327.9010709@gmail.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B23@ism-mail03.corp.ad.wrs.com> Hi Beat, > Should I setup my code such that all accesses > to the serial port happen in one unique thread? > Would this prevent the problems that are described? Yes, I think that accessing your RXTXPort from a single thread should work around all the issues discussed here. One option for doing so might be if you create a "frontend" for your RXTXPort like a PipedStream that runs in a single thread but accepts input from multiple threads. Such code could be based on a BoundedBufferWithStateTracking See http://gee.cs.oswego.edu/dl/cpj/allcode.java and http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.tm.core/terminal/or g.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/Pi pedInputStream.java?root=DSDP_Project&view=markup Cheers, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/41f74564/attachment-0023.html From Martin.Oberhuber at windriver.com Tue Dec 11 10:05:56 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:05:56 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475B27F7.5040500@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B26@ism-mail03.corp.ad.wrs.com> U.George wrote: > close should set a flag, that would cause any further > I/O requests to throw an exception ). +1, I fully agree. Cheers, Martin From Martin.Oberhuber at windriver.com Tue Dec 11 10:09:06 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Tue, 11 Dec 2007 18:09:06 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <47598A99.2010601@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47598A99.2010601@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803D47B2C@ism-mail03.corp.ad.wrs.com> > > try { > > getSerialPort().removeEventListener(); > > Thread.sleep(50); //allow a little time for RXTX Native to catch > > up > > whats there to catch up? > what that a patch for user code? or for RXTX ? This was a "hack workaround" in our user code that helped fixing an issue we had. I don't know why it works, but it works. With all the discusssions we've had so far, it should be possible to make close() thread-safe such that this workaround is not needed any more. Cheers Martin From netbeans at gatworks.com Tue Dec 11 10:11:04 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 12:11:04 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <20071211162630.GI2253@elberon.bln.de.ingenico.com> References: <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> <20071211162630.GI2253@elberon.bln.de.ingenico.com> Message-ID: <475EC4A8.6050204@gatworks.com> > So I think, having (or keeping, with some extensions / fixes) > this `threadsafety' as a lib feature keeps rxtx easily usable and > everyone would benefit :) Being synchronize'd does not guarantee the correct ordering of I/O operations. When the synchronized routine completes, all waiters are woken at the same time, and all have an opportunity ( but not all equal ) to obtain the sync'd routine. That type of coordination is beyond a library. From dwippermann at gmx.net Tue Dec 11 11:08:53 2007 From: dwippermann at gmx.net (Daniel Wippermann) Date: Tue, 11 Dec 2007 19:08:53 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com> <47599422.4020003@gatworks.com> <0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca> <475B27F7.5040500@gatworks.com> <836B0790-B266-46D8-B73A-48E4E85F82FD@gmx.net> <6EE5FE49-1E30-4E08-A752-BF5B169C0E72@gmx.net> <695CE8C6-D794-464A-9550-150C1501A09F@gmx.net> <2EBCCE74-ED5D-4F37-A56A-6266CCD983BA@gmx.net> Message-ID: <06C5F84B-E3F7-42E5-8248-42C03251F511@gmx.net> Hi all, > >> Those backward compatable routines are 'synchronize'd, so > >> should run no better that what rxtx is currently doing. > > > > Why do you think so? All write() methods in the SerialOutputStream > class > > are not synchronized at all at the moment. And the "synchronized" > read() > > methods only forbid to call more than one of them at any given time > > because they lock the SerialInputStream object they are living in. > But > > they have no locking influence on a concurrent write() and its > altering > > of IOLocked. So rxtx would do much better than what it is > currently doing. > Because, if you were to use the (AtomicInteger) > IOLocked.getAndIncrement(); u would get a hotspot/native operation in > JDK1.5 and JDK1.6, but with jdk1.3 & 1.4, with the backward compatible > routines, you would get the synchronise'd routine for getAndIncrement. > the JDK1.3 backward routine would be just as good as your suggested > code: > synchronize( oIOLocked ) { > IOLocked++; > } Oh, my fault. When I read "what rxtx is currently doing" I did not include my patch submission, since I do not count it as an official part of RXTX :) But yes, then you are right, it would make no difference in version prior to JDK5 and speed up things for all other versions. Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071211/25160f31/attachment-0023.html From netbeans at gatworks.com Tue Dec 11 11:36:42 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 11 Dec 2007 13:36:42 -0500 Subject: [Rxtx] Dual Core Problem In-Reply-To: <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> Message-ID: <475ED8BA.6040403@gatworks.com> The Commapi was not published. Suns philosophy was to have people learn their methods and madness. Sun also believed that you will forget the particular code in a few weeks, rather than the usual 2 years. So it was written. But you seem to forget that in order to replicate the behavior of that code, u need to look at the DOCS. And when that is not specific enough, then there has to be other ways to get that information. For instance the InputStream.read() is not DOC'd as synchronized. Nor is FileInputStream.read synchronized ( as per inspection of the JDK source ). If I further investigate, probably none of the InputStream derivatives are synchronized. Now that I have stated this, does your compliance with DOC's, in the removal of the synchronize, also mean that you adopted another coding license? And if the commapi code were to be published, and did not have the synchronized read ( as per actual code ) would that type of information still not be persuasive? BTW: exactly where did u get the idea that I was advocating cut&paste of someone-else's code? You learn by reading other peoples code. And if you read enough you can sometimes perceive software genealogy. Oberhuber, Martin wrote: > U.George wrote: > BTW: Since JAVA source went public, sorta, did java publish the > commapi source? > > Sun is publishing the OpenJDK under GPL 2 (with "classpath exception" > for > SOME files only, see the last paragraph of following link): > http://openjdk.java.net/legal/gplv2+ce.html > whereas RXTX is under (modified) LGPL. > > Please DONT go copy&paste GPL'd Sun code into LGPL'd RXTX. > > That would be a BIG problem at least for some companies using RXTX. > GPL is viral in that it might force companies open-source their > proprietary stuff if they link against a GPL'd lib! LGPL is not that > viral, at least not when linking dynamically. We'd really have a > problem when RXTX is infected with GPL'd code fragments. > > Therefore, please DONT even try finding the GPL'd Sun code, > read it or reference it otherwise. It's really a big threat. > Really. > > Thanks, > Martin > > From hunor.bartha at ambo.ro Tue Dec 11 11:55:24 2007 From: hunor.bartha at ambo.ro (Bartha Hunor) Date: Tue, 11 Dec 2007 20:55:24 +0200 Subject: [Rxtx] rxtxParallel problem Message-ID: <475EDD1C.2040002@ambo.ro> Hi, Hope somebody is reading this :). I have been using RXTX for serial communication in my java application and it all worked beautifully, but recently i tried to use the parallel port, and i had no success. I get the infamous link error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxParallel in java.library.path at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at gnu.io.LPRPort.(LPRPort.java:35) at gnu.io.RXTXCommDriver.getCommPort(RXTXCommDriver.java:810) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:343) If i remove all the parallel port related code from my class and leave only the code that uses the serial port everything works ok, the rxtxSerial dll is successfully loaded. I want to mention that the two dll's are in the same directory so i don't understand why is the rxtxSerial.dll found but not the rxtxParallel.dll. I suspect that there is a problem with the parallel dll. I searhced the web about this but i could find little data on people actually using rxtx for parallel communication. Is there anybody who successfully used this under Windows XP SP2 and JDK 1.5? Thanks, hunor From hhinze at gno.de Wed Dec 12 02:54:14 2007 From: hhinze at gno.de (hhinze at gno.de) Date: Wed, 12 Dec 2007 10:54:14 +0100 (CET) Subject: [Rxtx] RXTX and Bluetooth Message-ID: <17538664.1197453254852.JavaMail.ngmail@webmail19> Hi everybody, I'm experiencing some problems when trying to use the rxtx package to access a Bluetooth module. I hope this is the right place to ask. What I want to do is: accessing data in Flash (Windows XP) which have been sent by a microcontroller. Therefor I want to send the data from a serial port to a net port to be accessed over an IP. I use a RN-41 (Roving Networks) Bluetooth module with the Microcontroller. I can connect it with a Bluetooth dongle and get a usual serial COM port. This port can be connected to via several terminal progs (like Eltima e.g.) Then it's possible to communicate with the microcontroller over this terminal. What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. When I connect the microcontroller physically over a USB cable all works fine and I can use my rxtx server. I'm in the middle of my graduation project so I appreciate any help. Thanx Henner Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F?R ALLE NEUEINSTEIGER Jetzt bei Arcor: g?nstig und schnell mit DSL - das All-Inclusive-Paket f?r clevere Doppel-Sparer, nur 29,95 ? inkl. DSL- und ISDN-Grundgeb?hr! http://www.arcor.de/rd/emf-dsl-2 From Martin.Oberhuber at windriver.com Wed Dec 12 06:21:14 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:21:14 +0100 Subject: [Rxtx] RXTX and Bluetooth In-Reply-To: <17538664.1197453254852.JavaMail.ngmail@webmail19> References: <17538664.1197453254852.JavaMail.ngmail@webmail19> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB233E@ism-mail03.corp.ad.wrs.com> Hello Henner, try telling RXTX explicitly your port name: One option of doing so is System.setProperty("gnu.io.rxtx.SerialPorts", "YourPortName0"); for more details about manually specifying ports, see the source code in RXTXCommDriver.registerSpecifiedPorts(int) Cheers Martin -----Original Message----- From: rxtx-bounces at qbang.org [mailto:rxtx-bounces at qbang.org] On Behalf Of hhinze at gno.de Sent: Wednesday, December 12, 2007 10:54 AM To: rxtx at qbang.org Subject: [Rxtx] RXTX and Bluetooth What doesn't work is: when I try to connect to the "Bluetooth port" via the rxtx package it's invisible. I get a NoSuchPortException. It's only visible while I'm connected to the port with one of those terminal progs. But then the port is locked by the other application of course and can't be used. From Martin.Oberhuber at windriver.com Wed Dec 12 06:34:26 2007 From: Martin.Oberhuber at windriver.com (Oberhuber, Martin) Date: Wed, 12 Dec 2007 14:34:26 +0100 Subject: [Rxtx] Dual Core Problem In-Reply-To: <475ED8BA.6040403@gatworks.com> References: <460801A4097E3D4CA04CC64EE648584803CC8D5F@ism-mail03.corp.ad.wrs.com><47599422.4020003@gatworks.com><0361E8F9-0A65-4D91-AE34-45877CF51F35@sympatico.ca><475B27F7.5040500@gatworks.com><475BD523.3000900@gatworks.com> <475C3F3B.9050003@gatworks.com> <460801A4097E3D4CA04CC64EE648584803D47B15@ism-mail03.corp.ad.wrs.com> <475ED8BA.6040403@gatworks.com> Message-ID: <460801A4097E3D4CA04CC64EE648584803DB2354@ism-mail03.corp.ad.wrs.com> Hi George, > exactly where did u get the idea that I was advocating > cut&paste of someone-else's code? You learn by reading > other peoples code. And if you read enough you can > sometimes perceive software genealogy. no offence meant, I didn't think you were advocating copy& paste. I just wanted people to be aware of potential GPL problems, and thus be careful. I'm not a lawyer, so I cannot guarantee that the following is true: but in my understanding, reading code in order to get ideas does not violate copyright because only a specific expression of code (read: verbatim copy) can be copyrighted. Algorithms, code structures and APIs can be patented but not copyrighted; thus, in terms of GPL'd code, only verbatim copy & paste is a real threat. That being said, reading DOCs should be OK. Even talking about particular aspects of implementation _should_ be OK. Still, I personally prefer being over-careful and not even digging into GPL code looking for information, if I can avoid it. Code scanners like BlackDuck will find code that has been taken from somewhere else. And if Sun wanted to be malicious to other companies, taking the GPL as a weapon, they have everything they need. So again, please be careful and use good judgement. Getting RXTX GPL-infested would be a problem for us. Thanks, Martin From ajmas at sympatico.ca Wed Dec 12 20:09:40 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:09:40 -0500 Subject: [Rxtx] Help me ,please In-Reply-To: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> References: <8191775.874261197288794663.JavaMail.coremail@bj163app62.163.com> Message-ID: <298B975C-A04C-4516-8A61-9BE8E887B936@sympatico.ca> You need to get the latest code from CVS, since this issue has been resolved since: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code You'll want the code from the 2.1 branch. Andre On 10-Dec-07, at 07:13 , ?? wrote: > > > I used a common-user in the MAC OS 10.5. When i used rxtx 21.7 to > open the serial port on the MAC OS 10.5.the rxtx has a error. > how can I do ? thanks > > description: > error testing lock file creation error details:permission > deniedcheck_lock_status:no perminssion to create lock file. > please see: how can I use lock files with rxtx ? in install > > > ?????????? ?????????????? > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Wed Dec 12 20:12:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 12 Dec 2007 22:12:30 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <475D4901.7030503@verizon.net> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> Message-ID: <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> On 10-Dec-07, at 09:11 , Bill Christens-Barry wrote: > Andre, > > Thanks for this. I'm not on top of using cvs, but I was able to > follow the instructions on the CVS page of the rxtx site to get the > code (via "cvs checkout rxtx-devel"). Is this the right branch? Not > having read any readmes etc. that may be in the project, I'm not > sure now how I go about doing a build - are there any special tools > I need for this to run on a MacBook Pro Core2Duo intel? I have the > usual developer tools, but am unsure about various libraries that > may be needed. > > Incidentally, I was able to get the version I mentioned in my list > posting by creating a lock folder. I'm not sure what repercussions > this may have, so I'm Hi, Instruction for getting from CVS: http://rxtx.qbang.org/wiki/index.php/Retrieving_Source_Code and building on MacOS X: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X Let me know if they help. Andre From fabioanjos at gmail.com Thu Dec 13 04:25:38 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Thu, 13 Dec 2007 09:25:38 -0200 Subject: [Rxtx] Building RXTX in Windows Message-ID: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Hi, I checked out RXTX from cvs, and then I tried to build it for Windows following the instructions in http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. Are those procedures updated? I tried firts with MinGW, then the folowing errors ocurred: C:\dev\workspace\rxtx-devel\build>make MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. Error makefile 95: No match found for wildcard '/*.java)' Error makefile 95: No match found for wildcard '/*.c)' Error makefile 95: No match found for wildcard '/*.cc)' *** 3 errors during make *** Then I tried with lcc: C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 Could no t find include file Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `void' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 skippi ng `*' `,' `jclass' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 redefi nition of 'JNICALL' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 Previo us definition of 'JNICALL' here Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_open' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 skippi ng `*' `,' `jobject' `,' `jstring' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `JNICALL' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 Syntax error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 syntax error; found `*' expecting ')' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 skippi ng `*' `,' `jobject' `,' `jint' Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 extran eous old-style parameter list Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 Syntax error; missing semicolon before `jint' Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 no t ype specified. Defaulting to int Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 too ma ny errors ** error 1 ** deleting SerialImp.obj Any help apreciated! -- F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071213/f0befaa2/attachment-0022.html From ajmas at sympatico.ca Thu Dec 13 07:15:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:31 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> Message-ID: <3708825F-4C31-4DA0-AB81-783AC1AE2777@sympatico.ca> On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. One other thing, is that while you can use xcode, you can also build everything from the command line: ./configure make I wrote some instructions here: http://rxtx.qbang.org/wiki/index.php/Installation_on_MacOS_X If there are problems with them, then I will update them. Andre PS Please try to keep mailings on the list, so others can benefit. From ajmas at sympatico.ca Thu Dec 13 07:15:49 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 09:15:49 -0500 Subject: [Rxtx] Using rxtx-2.1-7r2 under Mac OS 10.5.1, trying to resolve CommPortIdentifier problem ? In-Reply-To: <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> References: <47576BBD.1050703@verizon.net> <475D4901.7030503@verizon.net> <01A13D6F-BA2C-4086-B62A-3F34B613D689@sympatico.ca> <4760B475.1050900@verizon.net> <8CCAEEDB-9311-4EB9-AC18-52F074C857A3@sympatico.ca> Message-ID: On 12-Dec-07, at 23:26 , Bill Christens-Barry wrote: > Andre, > > Thanks for following up on this. Yes, I tried the links you give but > ran into trouble during the build in Xcode. There were 101 errors, > all of which I believe were related to the single, first error that > had to do with the absence of javax.comm. I can't give you any more > detail, as it was several days ago that I tried this. This was on a > Powerbook G4 running Mac OS 10.4.11, with a recent version of Xcode. Are you sure you are building the code from the 2.1 branch? This error sounds symptomatic of an attempt to build code from the 2.0 branch. Andre From tjarvi at qbang.org Thu Dec 13 08:05:42 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 13 Dec 2007 08:05:42 -0700 (MST) Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> References: <29788b250712130325r24e31afeu54a2f4eb72af612c@mail.gmail.com> Message-ID: On Thu, 13 Dec 2007, F?bio Cristiano dos Anjos wrote: > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > > I tried firts with MinGW, then the folowing errors ocurred: > > C:\dev\workspace\rxtx-devel\build>make > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > Error makefile 95: No match found for wildcard '/*.java)' > Error makefile 95: No match found for wildcard '/*.c)' > Error makefile 95: No match found for wildcard '/*.cc)' > *** 3 errors during make *** > > Then I tried with lcc: > > C:\dev\workspace\rxtx-devel\src>make -f ..\Makefile.lcc > MAKE Version 5.2 Copyright (c) 1987, 1998 Inprise Corp. > lcc -I\JDK\INCLUDE -I\jdk\include\win32 -I. SerialImp.c > cpp: c:\dev\workspace\rxtx-devel\src\gnu_io_rxtxport.h:2 serialimp.c:64 > Could no > t find include file > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `void' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_Initialize' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > skippi > ng `*' `,' `jclass' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 64 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > redefi > nition of 'JNICALL' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 63 > Previo > us definition of 'JNICALL' here > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_open' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 71 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > skippi > ng `*' `,' `jobject' `,' `jstring' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 72 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `JNICALL' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > Syntax > error; missing semicolon before `Java_gnu_io_RXTXPort_nativeGetParity' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 79 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > syntax > error; found `*' expecting ')' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > skippi > ng `*' `,' `jobject' `,' `jint' > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 80 > extran > eous old-style parameter list > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > Syntax > error; missing semicolon before `jint' > Warning c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > no t > ype specified. Defaulting to int > Error c:\dev\workspace\rxtx-devel\src\serialimp.c: gnu_io_rxtxport.h: 87 > too ma > ny errors > ** error 1 ** deleting SerialImp.obj > Any help apreciated! > > You probably want to use GNU make. Especially with mingw32. The -I lines need to be changed with lcc. They should point to the include directories that come with your JDK. lcc instructions are not updated very often. Not many people use it. They should be close enough to get you going though. Some of the path variables in the makefile will need to be adjusted for you filesystem layout. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 13 09:32:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 13 Dec 2007 11:32:30 -0500 Subject: [Rxtx] Building RXTX in Windows Message-ID: <6bpm1d$51c4do@toip4.srvr.bell.ca> "F?bio Cristiano dos Anjos" wrote: > > Hi, > > I checked out RXTX from cvs, and then I tried to build it for > Windows following the instructions in > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > Are those procedures updated? > I suspect that they aren't up to date. If anyone has any experience building RXTX on Windows, could I ask for you to check the instructions and update them as necessary. The sort of things that would be worth mentioning: - required tools & environment variables - build steps Thanks Andre -------------- next part -------------- _______________________________________________ Rxtx mailing list Rxtx at qbang.org http://mailman.qbang.org/mailman/listinfo/rxtx From vorobyev.a at gmail.com Fri Dec 14 01:16:27 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 11:16:27 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47623BDB.90604@gmail.com> Good day. I have build rxtx from souce and copy *.so to /lib linux-fceg:/lib # ll /lib/librxtx* lrwxrwxrwx 1 root root 18 Dec 13 19:41 /lib/librxtxParallel-2.1-7.so -> librxtxParallel.so -rwxr-xr-x 1 root root 7696 Dec 13 19:52 /lib/librxtxParallel.so lrwxrwxrwx 1 root root 16 Dec 13 19:41 /lib/librxtxSerial-2.1-7.so -> librxtxSerial.so -rwxr-xr-x 1 root root 38936 Dec 13 19:52 /lib/librxtxSerial.so run program: ==================================================== java.lang.UnsatisfiedLinkError: gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while loading gnu.io.RXTXCommDriver java.lang.NoClassDefFoundError: Could not initialize class gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver After that i have compared new and original natile library. New: linux-fceg:/lib # nm librxtxSerial.so 00001470 T Java_gnu_io_CommPortIdentifier_native_1psmisc_1report_1owner 00002f08 a _DYNAMIC 00002ff4 a _GLOBAL_OFFSET_TABLE_ w _Jv_RegisterClasses 00002ef8 d __CTOR_END__ 00002ef4 d __CTOR_LIST__ 00002f00 d __DTOR_END__ 00002efc d __DTOR_LIST__ 000015c0 r __FRAME_END__ 00002f04 d __JCR_END__ 00002f04 d __JCR_LIST__ 00003078 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 00001500 t __do_global_ctors_aux 00000a30 t __do_global_dtors_aux 00003070 d __dso_handle w __gmon_start__ 00000ac7 t __i686.get_pc_thunk.bx U __lxstat@@GLIBC_2.0 U __strdup@@GLIBC_2.0 U __strtol_internal@@GLIBC_2.0 U __xstat@@GLIBC_2.0 00003078 A _edata 000031a0 A _end 00001534 T _fini 00000824 T _init U chdir@@GLIBC_2.0 U closedir@@GLIBC_2.0 00003080 b completed.6049 U exit@@GLIBC_2.0 U fclose@@GLIBC_2.1 00003088 b files U fopen@@GLIBC_2.1 00003090 b found_item 00000a90 t frame_dummy U fscanf@@GLIBC_2.0 U fwrite@@GLIBC_2.0 U getpid@@GLIBC_2.0 U getpwuid@@GLIBC_2.0 U getuid@@GLIBC_2.0 0000308c b last.5254 00003084 b last_named U malloc@@GLIBC_2.0 U opendir@@GLIBC_2.0 00003074 d p.6047 00000ad0 T parse_args U perror@@GLIBC_2.0 U readdir@@GLIBC_2.0 000030a0 B returnstring 00000c60 T scan_fd U seteuid@@GLIBC_2.0 00001090 T show_user U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strcat@@GLIBC_2.0 U strcmp@@GLIBC_2.0 U strcpy@@GLIBC_2.0 Original: /*00001198 T Java_gnu_io_LPRPort_Initialize 00001744 T Java_gnu_io_LPRPort_eventLoop 00001908 T Java_gnu_io_LPRPort_getInputBufferSize 00000fb0 T Java_gnu_io_LPRPort_getOutputBufferFree 0000191c T Java_gnu_io_LPRPort_getOutputBufferSize 0000101c T Java_gnu_io_LPRPort_isPaperOut 00001068 T Java_gnu_io_LPRPort_isPrinterBusy 000010b4 T Java_gnu_io_LPRPort_isPrinterError 00001100 T Java_gnu_io_LPRPort_isPrinterSelected 0000114c T Java_gnu_io_LPRPort_isPrinterTimedOut 00001254 T Java_gnu_io_LPRPort_nativeClose 000016cc T Java_gnu_io_LPRPort_nativeavailable 000011e0 T Java_gnu_io_LPRPort_open 00001578 T Java_gnu_io_LPRPort_readArray 000014e4 T Java_gnu_io_LPRPort_readByte 0000173c T Java_gnu_io_LPRPort_setHWFC 00001900 T Java_gnu_io_LPRPort_setInputBufferSize 00000fd8 T Java_gnu_io_LPRPort_setLPRMode 00001914 T Java_gnu_io_LPRPort_setOutputBufferSize 000012f4 T Java_gnu_io_LPRPort_writeArray 0000128c T Java_gnu_io_LPRPort_writeByte*/ 00002e38 a _DYNAMIC 00002f20 a _GLOBAL_OFFSET_TABLE_ 00002e2c d __CTOR_END__ 00002e28 d __CTOR_LIST__ 00002e34 d __DTOR_END__ 00002e30 d __DTOR_LIST__ 00002e24 d __EH_FRAME_BEGIN__ 00002e24 d __FRAME_END__ 00002fa0 A __bss_start w __cxa_finalize@@GLIBC_2.1.3 w __deregister_frame_info@@GLIBC_2.0 00001c04 t __do_global_ctors_aux 00000eb4 t __do_global_dtors_aux 00002f94 d __dso_handle U __errno_location@@GLIBC_2.0 w __gmon_start__ w __register_frame_info@@GLIBC_2.0 00002fa0 A _edata 00002fb8 A _end 00001c50 T _fini 00000cb8 T _init 00000e80 t call_gmon_start U close@@GLIBC_2.0 00002f9c d completed.1 00000f50 t fini_dummy 00002fa0 d force_to_data 00002fa0 d force_to_data U fprintf@@GLIBC_2.0 00000f60 t frame_dummy U free@@GLIBC_2.0 00000eb0 t gcc2_compiled. 00001c00 t gcc2_compiled. 00001b90 T get_java_var 00000fa0 t init_dummy 00001c40 t init_dummy U ioctl@@GLIBC_2.0 00001a70 T is_interrupted U malloc@@GLIBC_2.0 00002fa0 b object.2 U open@@GLIBC_2.0 00002f98 d p.0 U printf@@GLIBC_2.0 U read@@GLIBC_2.0 000013b8 T read_byte_array 00001a68 T report 00001a3c T report_error U select@@GLIBC_2.0 00001afc T send_event U sigaction@@GLIBC_2.0 U signal@@GLIBC_2.0 U sprintf@@GLIBC_2.0 U stderr@@GLIBC_2.0 U strerror@@GLIBC_2.0 00001928 T throw_java_exception 000019f8 T throw_java_exception_system_msg U usleep@@GLIBC_2.0 U write@@GLIBC_2.0 Why there are no several functions in my build? How to make correct build? From netbeans at gatworks.com Fri Dec 14 04:47:43 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 06:47:43 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47623BDB.90604@gmail.com> References: <47623BDB.90604@gmail.com> Message-ID: <47626D5F.20107@gatworks.com> [gat at mylaptop RXTX]$ find . -type f -exec grep -l nativeGetVersion {} \; ./RXTX-2.0/gnu_io_RXTXCommDriver.h ./RXTX-2.0/SerialImp.lo ./RXTX-2.1/librxtxSerial-2.1-7.so ./RXTX-2.1/SerialImp.o [gat at mylaptop RXTX]$ > java.lang.UnsatisfiedLinkError: > gnu.io.RXTXCommDriver.nativeGetVersion()Ljava/lang/String; thrown while > loading gnu.io.RXTXCommDriver > java.lang.NoClassDefFoundError: Could not initialize class > gnu.io.RXTXCommDriver thrown while loading gnu.io.RXTXCommDriver From vorobyev.a at gmail.com Fri Dec 14 08:30:58 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 18:30:58 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762A1B2.2070304@gmail.com> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep -l nativeGetVersion {} \; ./WinCE/gnu_io_RXTXCommDriver.cpp ./WinCE/gnu_io_RXTXCommDriver.h ./CNI/RXTXCommDriver.java ./CNI/SerialImp.c ./gnu/io/RXTXVersion.class ./gnu/io/RXTXCommDriver.class ./i686-pc-linux-gnu/gnu_io_RXTXVersion.h ./i686-pc-linux-gnu/.libs/SerialImp.o ./i686-pc-linux-gnu/gnu_io_RXTXCommDriver.h ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/librxtxSerial.jnilib ./MACOSX_IDE/ForPackageMaker/Install/Library/Java/Extensions/RXTXcomm.jar ./src/Serial.def ./src/RXTXVersion.java ./src/RXTXCommDriver.java ./src/SerialImp.c I have build rxtx under centos 4. Similar result vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> gcc --version gcc (GCC) 4.2.1 (SUSE Linux) vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> java -version java version "1.6.0_02" From vorobyev.a at gmail.com Fri Dec 14 09:23:36 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Fri, 14 Dec 2007 19:23:36 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <4762AE08.6060508@gmail.com> linux-fceg:/usr/src/rxtx-2.1-7r2 # make install make all-am make[1]: Entering directory `/usr/src/rxtx-2.1-7r2' make[1]: Leaving directory `/usr/src/rxtx-2.1-7r2' libtool: install: `i686-pc-linux-gnu/librxtxRS485.la' is not a directory Try `libtool --help --mode=install' for more information. make: *** [install] Error 1 From netbeans at gatworks.com Fri Dec 14 06:24:37 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:24:37 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628415.7050409@gatworks.com> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so not RXTX 2.0 From netbeans at gatworks.com Fri Dec 14 06:29:29 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 08:29:29 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4762A1B2.2070304@gmail.com> References: <4762A1B2.2070304@gmail.com> Message-ID: <47628539.8030205@gatworks.com> 1) get 2.1 2) build it there ( ie ./configure; make ) 3) look for the missing linkage 3a) still missing - call back here 4) go back to your java devel site 5) export LD_LIBRARY_PATH=/path_to_build_shares/ 6) export CLASSPATH=/pathtothecommapi 7) java ......... ( dont use -jar ) A lexander Vorobyev wrote: > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> find . -type f -exec grep From ajmas at sympatico.ca Fri Dec 14 16:28:04 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 18:28:04 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47628539.8030205@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> Message-ID: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> On 14-Dec-07, at 08:29 , U. George wrote: > 1) get 2.1 > 2) build it there ( ie ./configure; make ) > 3) look for the missing linkage > 3a) still missing - call back here > 4) go back to your java devel site > 5) export LD_LIBRARY_PATH=/path_to_build_shares/ > 6) export CLASSPATH=/pathtothecommapi > 7) java ......... ( dont use -jar ) While on this topic, are there any issues in the instructions given here: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux I have made a best attempt at making sure they are right, but I don't currently have a linux install to validate the instructions. Andre From netbeans at gatworks.com Fri Dec 14 16:50:11 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 14 Dec 2007 18:50:11 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <476316B3.7010201@gatworks.com> Nothing stands out technically. Except maybe if you are running a different shell: > [gat at mylaptop ~]$ setenv > bash: setenv: command not found But there 2 java's out there. The one that is distributed with the OS ( derivitive from gcc et al, but also called java ) and that from SUN/javasoft. Someone suggested that rxtx can be minimally run with jdk 1.3. I dont like the (rxtx) install. giving root privs is not best. Also dont like that the binaries are placed in the installed jre/jdk distribution ( ergo the LD_LIBRARY_PATH, and the CLASSPATH specifications. ) If you cant get root privs, then the sudo proceedure provides no alternatives. I also dont like the "must be admin" on windows in order to install anything. I was told that almost everything is installed that way ( with privs, and lots of faith ) ! :{ Andre-John Mas wrote: > > On 14-Dec-07, at 08:29 , U. George wrote: > >> 1) get 2.1 >> 2) build it there ( ie ./configure; make ) >> 3) look for the missing linkage >> 3a) still missing - call back here >> 4) go back to your java devel site >> 5) export LD_LIBRARY_PATH=/path_to_build_shares/ >> 6) export CLASSPATH=/pathtothecommapi >> 7) java ......... ( dont use -jar ) > > While on this topic, are there any issues in the instructions given here: > > http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux > > I have made a best attempt at making sure they are right, but I don't > currently have a linux install to validate the instructions. > > Andre > > From aleeudin_17 at yahoo.com Fri Dec 14 17:58:23 2007 From: aleeudin_17 at yahoo.com (akhmad alimudin) Date: Fri, 14 Dec 2007 16:58:23 -0800 (PST) Subject: [Rxtx] how to use rxtx eclipse Message-ID: <100879.31838.qm@web45509.mail.sp1.yahoo.com> hi all,,, im a newbie here... i want to ask about how if i use eclipse IDE for rxtx,,,, i mean what should i set first in eclipse, maybe classpath environment,,,,it's because i've never use eclipse before... thanks regards, Akhmad Alimudin, Indonesia --------------------------------- Never miss a thing. Make Yahoo your homepage. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071214/ed6f6d9e/attachment-0020.html From tjarvi at qbang.org Fri Dec 14 18:04:43 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Fri, 14 Dec 2007 18:04:43 -0700 (MST) Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: On Fri, 14 Dec 2007, akhmad alimudin wrote: > hi all,,, im a newbie here... i want to ask about how if i use eclipse > IDE for rxtx,,,, i mean what should i set first in eclipse, maybe > classpath environment,,,,it's because i've never use eclipse before... > I think you will need to reorganize the rxtx source. Just place the source files in /gnu/io/ and try from there. We have discussed changing the layout to work with new IDEs. It isn't a bad idea. rxtx native code will not build but you can build the java class files. Anyone built native libs in Eclipse? -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Fri Dec 14 21:20:21 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 14 Dec 2007 23:20:21 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> Message-ID: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Hi, I have just updated the Linux instructions, using suggestions from U. George. If you can't get the make install to work, there are two other approaches: http://rxtx.qbang.org/wiki/index.php/Installation_on_Linux Let us know if 'method 2' works better for you. Andre From vorobyev.a at gmail.com Sat Dec 15 00:53:12 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 10:53:12 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> Message-ID: <476387E8.7040809@gmail.com> The problem not in that where to copy *.so and how correctly to set CLASSPATH a problem in it : http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html *.so build incorrectly linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxI2C.so -> librxtxI2C-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel-2.1-7.so lrwxrwxrwx 1 root root 24 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxParallel.so -> librxtxParallel-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485-2.1-7.so lrwxrwxrwx 1 root root 21 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRS485.so -> librxtxRS485-2.1-7.so -rwxr-xr-x 1 root root 7696 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw-2.1-7.so lrwxrwxrwx 1 root root 19 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxRaw.so -> librxtxRaw-2.1-7.so -rwxr-xr-x 1 root root 38936 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial-2.1-7.so lrwxrwxrwx 1 root root 22 Dec 15 10:37 i686-pc-linux-gnu/.libs/librxtxSerial.so -> librxtxSerial-2.1-7.so Has still noticed - the size of librxtxParallel-2.1-7.so less in 8 times. From vorobyev.a at gmail.com Sat Dec 15 01:09:41 2007 From: vorobyev.a at gmail.com (Alexander Vorobyev) Date: Sat, 15 Dec 2007 11:09:41 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install Message-ID: <47638BC5.4080702@gmail.com> Good day Mr. George >> If you will notice, in my build(s), that only RXTX2.1 has it defined in a .so vorobyev.a at linux-fceg:/usr/src/*rxtx-2.1-7r2*> I am build source rxtx-2.1-7r2 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/2564b247/attachment-0020.html From netbeans at gatworks.com Sat Dec 15 03:45:47 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 05:45:47 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763B05B.8020509@gatworks.com> Not sure what u are asking anymore. My preference is to not *copy* .so anywhere. Until u know whats going on, change the names of the librxtx*.so's from all the places around your system so they do not get referenced at all. ie: for i in /lib/librxtx*.so; do mv $i $i.backup; done Also the same for the RXTXcomm.jar that maybe in a jdk/jre directory. I think that the RXTXcomm.jar ( actually *.jar ) from the jdk/jre is read/processed before your CLASSPATH. for CLASSPATH, I would have it set to: export CLASSPATH=$CLASSPATH:/pathtorxtxcomm.jar/RXTXcomm.jar what I have in my rxtx-2.1 directory is: > [gat at mylaptop rxtx-2.1]$ ll i686-pc-linux-gnu/.libs/ > total 468 > -rw-rw-r-- 1 gat gat 35676 Dec 15 05:34 fuserImp.o > -rw-rw-r-- 1 gat gat 59216 Dec 15 05:35 I2CImp.o > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxI2C-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxI2C.la -> ../librxtxI2C.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxI2C.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxI2C.so -> librxtxI2C-2.1-7.so > -rwxrwxr-x 1 gat gat 4066 Dec 15 05:35 librxtxParallel-2.1-7.so > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxParallel.la -> ../librxtxParallel.la > -rw-rw-r-- 1 gat gat 891 Dec 15 05:35 librxtxParallel.lai > lrwxrwxrwx 1 gat gat 24 Dec 15 05:35 librxtxParallel.so -> librxtxParallel-2.1-7.so > -rwxrwxr-x 1 gat gat 4058 Dec 15 05:35 librxtxRaw-2.1-7.so > lrwxrwxrwx 1 gat gat 16 Dec 15 05:35 librxtxRaw.la -> ../librxtxRaw.la > -rw-rw-r-- 1 gat gat 856 Dec 15 05:35 librxtxRaw.lai > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxRaw.so -> librxtxRaw-2.1-7.so > -rwxrwxr-x 1 gat gat 4062 Dec 15 05:35 librxtxRS485-2.1-7.so > lrwxrwxrwx 1 gat gat 18 Dec 15 05:35 librxtxRS485.la -> ../librxtxRS485.la > -rw-rw-r-- 1 gat gat 870 Dec 15 05:35 librxtxRS485.lai > lrwxrwxrwx 1 gat gat 21 Dec 15 05:35 librxtxRS485.so -> librxtxRS485-2.1-7.so > -rwxrwxr-x 1 gat gat 34950 Dec 15 05:35 librxtxSerial-2.1-7.so > lrwxrwxrwx 1 gat gat 19 Dec 15 05:35 librxtxSerial.la -> ../librxtxSerial.la > -rw-rw-r-- 1 gat gat 877 Dec 15 05:35 librxtxSerial.lai > lrwxrwxrwx 1 gat gat 22 Dec 15 05:35 librxtxSerial.so -> librxtxSerial-2.1-7.so > -rw-rw-r-- 1 gat gat 41472 Dec 15 05:35 ParallelImp.o > -rw-rw-r-- 1 gat gat 61192 Dec 15 05:35 RawImp.o > -rw-rw-r-- 1 gat gat 59964 Dec 15 05:35 RS485Imp.o > -rw-rw-r-- 1 gat gat 120724 Dec 15 05:34 SerialImp.o > [gat at mylaptop rxtx-2.1]$ ll RXTXcomm.jar > -rw-rw-r-- 1 gat gat 59325 Dec 15 05:34 RXTXcomm.jar > [gat at mylaptop rxtx-2.1]$ Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set > CLASSPATH a problem in it : > http://mailman.qbang.org/pipermail/rxtx/2007-December/1748196.html > *.so build incorrectly > > linux-fceg:/usr/src/rxtx-2.1-7r2 # ll i686-pc-linux-gnu/.libs/*.so > -rwxr-xr-x 1 root root 7696 Dec 15 10:37 > i686-pc-linux-gnu/.libs/librxtxI2C-2.1-7.so > From netbeans at gatworks.com Sat Dec 15 05:01:17 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 07:01:17 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <476387E8.7040809@gmail.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> Message-ID: <4763C20D.4070306@gatworks.com> try this ( configure && configure.in ): Linux) LDFLAGS=$LDFLAGS" -lpthread" check_kernel_headers check_java_headers CFLAGS=$CFLAGS" -D__need_timespec" case $JAVA_VERSION in 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 Alexander Vorobyev wrote: > The problem not in that where to copy *.so and how correctly to set From sebastien.jean.rxtx at gmail.com Sat Dec 15 05:36:06 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 13:36:06 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <100879.31838.qm@web45509.mail.sp1.yahoo.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> Message-ID: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Hi, akhmad Using rxtx with eclipse is very easy if what you want to do is build Java applications that use rxtx jar and libs. What you have to do is : - creating a new eclipse project - creating sub directories in the project tree, where RXTXComm.jar and native libs should go (i assume in the following that this directory is called "lib") - configuring the 'java build path" section of the project properties in order to add RXTXComm.jar to the classpath - while executing your java app that use rxtx, adding a "VM argument" in run dialog box. The argument is "-Djava.library.path=./lib", it helps VM to load the native lib While doing that, you no longer need to place rxtx jar and libs in platform-dependant well-known directories. Best regards, S?bastien. Le 15 d?c. 07 ? 01:58, akhmad alimudin a ?crit : > hi all,,, > im a newbie here... > i want to ask about how if i use eclipse IDE for rxtx,,,, i mean > what should i set first in eclipse, maybe classpath > environment,,,,it's because i've never use eclipse before... > > > thanks > > regards, > > Akhmad Alimudin, Indonesia > > Never miss a thing. Make Yahoo your homepage. > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071215/0d6cf1d6/attachment-0020.html From mark at mdsh.com Sat Dec 15 07:13:18 2007 From: mark at mdsh.com (Mark Himsley) Date: Sat, 15 Dec 2007 14:13:18 +0000 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> Message-ID: <5AA51926D0FB423A79423A01@macmini.mdsh.local> On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > - configuring the 'java build path" section of the project properties in > order to add RXTXComm.jar to the classpath > - while executing your java app that use rxtx, adding a "VM argument" in > run dialog box. The argument is "-Djava.library.path=./lib", it helps VM > to load the native lib Don't need to do that last step if you do something else... Once you have added RXTXComm.jar to the 'Libraries' tab of the Java Build Path, [+] open the the RXTXComm.jar, select 'Native library location' press 'Edit' and select the folder containing rxtx*.dll. Eclipse will magically add that to the java.library.path for you. -- Mark Himsley From sebastien.jean.rxtx at gmail.com Sat Dec 15 07:27:32 2007 From: sebastien.jean.rxtx at gmail.com (Sebastien Jean) Date: Sat, 15 Dec 2007 15:27:32 +0100 Subject: [Rxtx] how to use rxtx eclipse In-Reply-To: <5AA51926D0FB423A79423A01@macmini.mdsh.local> References: <100879.31838.qm@web45509.mail.sp1.yahoo.com> <57306160-8F9A-4E38-8C48-2745C91E3B05@gmail.com> <5AA51926D0FB423A79423A01@macmini.mdsh.local> Message-ID: <1256BCA1-3AA3-43A0-A6AC-13CC85C6E6FB@gmail.com> Hi mark, i just did not know about this hint, i will try it next time ! thanks. S?bastien Le 15 d?c. 07 ? 15:13, Mark Himsley a ?crit : > On 15 December 2007 13:36:06 +0100 Sebastien Jean wrote: > >> - configuring the 'java build path" section of the project >> properties in >> order to add RXTXComm.jar to the classpath >> - while executing your java app that use rxtx, adding a "VM >> argument" in >> run dialog box. The argument is "-Djava.library.path=./lib", it >> helps VM >> to load the native lib > > Don't need to do that last step if you do something else... > > Once you have added RXTXComm.jar to the 'Libraries' tab of the Java > Build > Path, [+] open the the RXTXComm.jar, select 'Native library > location' press > 'Edit' and select the folder containing rxtx*.dll. Eclipse will > magically > add that to the java.library.path for you. > > > > -- > Mark Himsley > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From ajmas at sympatico.ca Sat Dec 15 08:08:41 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:08:41 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <47638BC5.4080702@gmail.com> References: <47638BC5.4080702@gmail.com> Message-ID: On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > Good day Mr. George > >> If you will notice, in my build(s), that only RXTX2.1 has it > defined in a .so > > vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> > I am build source rxtx-2.1-7r2 Ignoring the name issue for a moment, if you take 'librxtxSerial-2.1-7.so' put in ~/lib , for example and then make symbolic link to it: ln -s librxtxSerial.so librxtxSerial-2.1-7.so and then include the folder in you library path: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ add the jar to you CLASSPATH are you then able to run a program that depends on RXTX. Beyond that I am a little confused at to the issue. Andre From ajmas at sympatico.ca Sat Dec 15 08:21:30 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 15 Dec 2007 10:21:30 -0500 Subject: [Rxtx] Version native library and symbolic link Message-ID: Hi, I noticed that the build on MacOS X and Linux is slightly different. On MacOS X a single library file is created called 'librxtxSerial.jnilib' and on Linux the name includes the version, thus requiring a symbolic link to be made. I wonder whether the RXTXcomm.jar lib should try loading the unversioned library and on failure try the versioned. I realise that this would mean having to include the version in the jar, but this might avoid some issues with shared library being moved and no symbolic name being created. The version number would be put into a properties file that would be generated at build time and then included in the JAR for the code to find. Something like: Properties props = new Properties(); InputStream in = Thread.currentThread().getContextClassLoader() .getSystemResourceAsStream( "rxtx.properties" ); props.load( in ); String baseName = "rxtxSerial"; String version = props.getProperty("rxtx.version"); // "2.1-7"; boolean success; try { System.loadLibrary(baseName); success = true; } catch ( UnsatisfiedLinkError ex ) { } if ( success ) return; try { System.loadLibrary(baseName + "-" + version); success = true; } catch ( UnsatisfiedLinkError ex ) { throw new UnsatisfiedLinkError ("Unable to find native library with base name " + baseName + " or " + baseName + "-" + version); } Another point is that the jar name would need to include the version name too, just to avoid confusion. What do you think? Andre From netbeans at gatworks.com Sat Dec 15 09:17:26 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 11:17:26 -0500 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: References: <47638BC5.4080702@gmail.com> Message-ID: <4763FE16.3040405@gatworks.com> Andre-John Mas wrote: > > On 15-Dec-07, at 03:09 , Alexander Vorobyev wrote: > >> Good day Mr. George >> >> If you will notice, in my build(s), that only RXTX2.1 has it >> defined in a .so >> >> vorobyev.a at linux-fceg:/usr/src/rxtx-2.1-7r2> >> I am build source rxtx-2.1-7r2 > > Ignoring the name issue for a moment, if you take > 'librxtxSerial-2.1-7.so' put in > ~/lib , for example and then make symbolic link to it: > > ln -s librxtxSerial.so librxtxSerial-2.1-7.so > > and then include the folder in you library path: > > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ > > add the jar to you CLASSPATH > > are you then able to run a program that depends on RXTX. yes. So long as you dont use the java option -jar :{ The java -jar invokes a security concept where classpath is totally (and silently) ignored Beyond that I am > a little confused at to the issue. whats there to be confused about. the proper loading of shared libraries are defined by the OS ( for the most part ). For most folks LD_LIBRARY_PATH is empty/non-existant. All shared libraries are found in the *usual* ( pre-defined, pre-determined) places. Not everyone has writable access to system space where libraries, executables, and hidden-away stuff, are stored. This is a good thing ( (c)martha stewart ) The LD_LIBRARY_PATH shell variable is used by the LOADERS ( et al ) to define alternate area's where shared libraries can be found. I have it defined as: export LD_LIBRARY_PATH=/usr/local/rxtx-devel/lib the corresponding RXTXcomm.jar file can be found at: /usr/local/rxtx-devel/jar/RXTXcomm.jar Think of it in another way. the jdk/jre shared libraries are not 'well known' to the OS. Somewhere along the way, java has to figure out where 'its' shared libraries are, and tell the loader that its there. the jre/jdk also knows where its 'jars' are stored. Its all predefined. If you place RXTX ( shared libs and RXTXcomm.jar ) with the jdk/jre in the *usual* or expected places then ( I think ) everything will work. If you dont want to place these foreign objects with the java that is shared by all users, then u need to use CLASSPATH, and LD_LIBRARY_PATH to inform java and the loader where to find these pieces. If you want to flip between versions of RXTX easily, then the CLASSPATH/LD_LIBRARY_PATH way will make it fairly easy. Did I clear up anything ? From netbeans at gatworks.com Sat Dec 15 10:11:31 2007 From: netbeans at gatworks.com (U. George) Date: Sat, 15 Dec 2007 12:11:31 -0500 Subject: [Rxtx] Version native library and symbolic link In-Reply-To: References: Message-ID: <47640AC3.8020501@gatworks.com> The promise of shared libs is the ability to substitute one ( version ) of a shared library with another and *not* affect ( ie rebuild ) the programs that rely on it. So is the premise/promise ;-/ Although you can finagle any scheme you want, *traditionally* the symbolic name is a pointer to the shared library associated to the pointer. So if you want to lookup/link directly to librxtxSerial.so.3.2.8 you can. A user can as well do this: `cp librxtxSerial.so.9.2.1.so librxtxSerial.so.3.2.8 in order to get a new version of the shared library *out* . Of course, now, u'll never know that you are using librxtxSerial.so.9.2.1.so instead of librxtxSerial.so.3.2.8 Nothing is exactly required. Its just convenient, and backtracable. Andre-John Mas wrote: > Hi, > > I noticed that the build on MacOS X and Linux is slightly different. > On MacOS X > a single library file is created called 'librxtxSerial.jnilib' and on > Linux the > name includes the version, thus requiring a symbolic link to be made. > From vorobyev.a at gmail.com Sat Dec 15 22:03:22 2007 From: vorobyev.a at gmail.com (=?KOI8-R?B?4czFy9PBzsTSIPfP0s/C2MXX?=) Date: Sun, 16 Dec 2007 08:03:22 +0300 Subject: [Rxtx] Building rxtx in Linux / Problem after install In-Reply-To: <4763C20D.4070306@gatworks.com> References: <4762A1B2.2070304@gmail.com> <47628539.8030205@gatworks.com> <5EB7A386-0163-40E8-85E2-C812611A3C4A@sympatico.ca> <656EB978-F2C8-415E-9B90-91B793B3E47A@sympatico.ca> <476387E8.7040809@gmail.com> <4763C20D.4070306@gatworks.com> Message-ID: Thank you, very much. The problem is solved 2007/12/15, U. George : > try this ( configure && configure.in ): > Linux) > LDFLAGS=$LDFLAGS" -lpthread" > check_kernel_headers > check_java_headers > CFLAGS=$CFLAGS" -D__need_timespec" > case $JAVA_VERSION in > > 1.2*|1.3*|1.4*|1.5*|1.6*) <===== add in 1.6* for jdk1.6 > > Alexander Vorobyev wrote: > > The problem not in that where to copy *.so and how correctly to set > From fabioanjos at gmail.com Mon Dec 17 09:36:39 2007 From: fabioanjos at gmail.com (=?ISO-8859-1?Q?F=E1bio_Cristiano_dos_Anjos?=) Date: Mon, 17 Dec 2007 14:36:39 -0200 Subject: [Rxtx] Building RXTX in Windows In-Reply-To: <6bpm1d$51c4do@toip4.srvr.bell.ca> References: <6bpm1d$51c4do@toip4.srvr.bell.ca> Message-ID: <29788b250712170836q59e57b56kb3c697570f614bd5@mail.gmail.com> Hi all, I finally had success building RXTX in windows. I had to reinstall mingw (i think that the version i had was not complete), install cygwin, change some directory entries in the script, and put some directories in the PATH system variable (C:\MinGW\bin;C:\lcc\bin;C:\cygwin\bin;C:\MinGW\libexec\gcc\mingw32\3.4.5). But I am still having some problems in using it. Every time I try to open a port that is being user by other application, the isCurrentlyUsed method returns false, and the UnsatisfiedLinkError is thrown instead of the normal PortInUse exception, as shown below: Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: gnu.io.CommPortIdentifier.native_psmisc_report_owner (Ljava/lang/String;)Ljava/lang/String; at gnu.io.CommPortIdentifier.native_psmisc_report_owner(Native Method) at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:466) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptor (ReceptorFacade.java:344) at br.com.segware.sigmaProcessor.business.facade.ReceptorFacade.initializeReceptors (ReceptorFacade.java:277) at br.com.segware.sigmaProcessor.business.delegate.ReceptorDelegate.initializeReceptors (ReceptorDelegate.java:118) at br.com.segware.sigmaProcessor.view.panel.ReceptorPanel.( ReceptorPanel.java:93) at br.com.segware.sigmaProcessor.view.MainUI.(MainUI.java:61) at br.com.segware.sigmaProcessor.view.MainUI$6.run(MainUI.java:258) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Am I doing something wrong? Thanks in advance! F?bio -------- On Dec 13, 2007 2:32 PM, Andre-John Mas wrote: > "F?bio Cristiano dos Anjos" wrote: > > > > Hi, > > > > I checked out RXTX from cvs, and then I tried to build it for > > Windows following the instructions in > > http://rxtx.qbang.org/wiki/index.php/Installation_on_MS-Windows. > > > > Are those procedures updated? > > > > I suspect that they aren't up to date. If anyone has any experience > building RXTX on Windows, could I ask for you to check the > instructions and update them as necessary. The sort of things > that would be worth mentioning: > - required tools & environment variables > - build steps > > Thanks > > Andre > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > > -- Atenciosamente, F?bio Cristiano dos Anjos -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071217/63e4b047/attachment-0017.html From aleksandrb at gmail.com Tue Dec 18 05:03:14 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Tue, 18 Dec 2007 14:03:14 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD Message-ID: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Hi all, I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone through bluetooth. steps already done: 1. installed jdk5 2. installed pseudo port "ttyS1" 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) prefix in RxTxCommDriver (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I modified it (simply added ttyS prefix to array): --------------------------------------------------------------------------------------------------- else if(osName.equals("FreeBSD")) //FIXME this is probably wrong { String[] Temp = { "ttyd", //general purpose serial ports "cuaa", //dialout serial ports "ttyA", //Specialix SI/XIO dialin ports "cuaA", //Specialix SI/XIO dialout ports "ttyD", //Digiboard - 16 dialin ports "cuaD", //Digiboard - 16 dialout ports "ttyE", //Stallion EasyIO (stl) dialin ports "cuaE", //Stallion EasyIO (stl) dialout ports "ttyF", //Stallion Brumby (stli) dialin ports "cuaF", //Stallion Brumby (stli) dialout ports "ttyR", //Rocketport dialin ports "cuaR", //Rocketport dialout ports "stl", //Stallion EasyIO board or Brumby N "ttyS" //Pseudo terminal port }; CandidatePortPrefixes=Temp; } --------------------------------------------------------------------------------------------------- 5. installed modified RxTx 6. wrote this simple code to test if RxTx connects to my port: --------------------------------------------------------------------------------------------------- import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import java.util.logging.Level; import java.util.logging.Logger; public class Main { public static void main(String[] args) { try { if (args.length == 0) { System.out.println("specify port name! System exits."); System.exit(0); } String port = args[0].toLowerCase(); CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(port); SerialPort serialPort = (SerialPort) portId.open("SMSLib", 1971); System.out.println("Serial port name: " + serialPort.getName()); serialPort.close(); } catch (PortInUseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (NoSuchPortException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } } --------------------------------------------------------------------------------------------------- when trying to execute got exceptions: 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while loading driver gnu.io.RXTXCommDriver 2 - java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but somehow it is not found. and ununderstandable cast exception... gnu.io.rxtx.properties content: --------------------------------------------------------------------------------------------------- gnu.io.rxtx.SerialPorts=/dev/ttyS1 --------------------------------------------------------------------------------------------------- it is already week me trying to find solution, but without results, could someone help me with it? Thank you! From netbeans at gatworks.com Tue Dec 18 07:00:58 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:00:58 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D29A.80005@gatworks.com> Did u mean .toLowerCase ? not that it changes the problem of locating the properties file. > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); From netbeans at gatworks.com Tue Dec 18 07:20:37 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 09:20:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4767D735.80608@gatworks.com> If you have the tools, u can strace the open's, and forks: If you read the rxtx src code: from: http://java.sun.com/j2se/1.4.2/docs/guide/extensions/spec.html the line(s) Other locations for installed optional packages can be specified through the system property java.ext.dirs. This property specifies one or more directories to search for installed optional packages, each separated by File.pathSeparatorChar. The default setting for this property is the standard directory for installed optional packages indicated above. it appears ( my guess ) that "java.ext.dirs" is null. *Maybe* if you define is in the shell script it will work ie: export java.ext.dirs=/usr/local/java/jre/lib/ext/ -------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) > > file gnu.io.rxtx.properties exists in /usr/local/java/jre/lib/ext/ but > somehow it is not found. and ununderstandable cast exception... From ajmas at sympatico.ca Tue Dec 18 18:59:11 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Tue, 18 Dec 2007 20:59:11 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> Message-ID: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> On 18-Dec-07, at 07:03 , Aleksandr Bissekerskij wrote: > Hi all, > > I use SMSLib (www.smslib.org) with RxTx to connect to mobile phone > through bluetooth. > > steps already done: > 1. installed jdk5 > 2. installed pseudo port "ttyS1" > 3. installed RxTx (rxtx-2.1-7-bins-r2.zip) > 4. than I noteiced that RxTx doesn't list ttyS (pseudo serial ports) > prefix in RxTxCommDriver > (rxtx-2.1-7r2.zip\rxtx-2.1-7r2\src\RXTXCommDriver.java ), so I > modified it (simply added ttyS prefix to array): > > --------------------------------------------------------------------------------------------------- > else if(osName.equals("FreeBSD")) //FIXME this is probably wrong > { > String[] Temp = { > "ttyd", //general purpose serial ports > "cuaa", //dialout serial ports > "ttyA", //Specialix SI/XIO dialin ports > "cuaA", //Specialix SI/XIO dialout ports > "ttyD", //Digiboard - 16 dialin ports > "cuaD", //Digiboard - 16 dialout ports > "ttyE", //Stallion EasyIO (stl) dialin ports > "cuaE", //Stallion EasyIO (stl) dialout ports > "ttyF", //Stallion Brumby (stli) dialin ports > "cuaF", //Stallion Brumby (stli) dialout ports > "ttyR", //Rocketport dialin ports > "cuaR", //Rocketport dialout ports > "stl", //Stallion EasyIO board or Brumby N > "ttyS" //Pseudo terminal port > }; > CandidatePortPrefixes=Temp; > } > --------------------------------------------------------------------------------------------------- > > 5. installed modified RxTx > 6. wrote this simple code to test if RxTx connects to my port: > > --------------------------------------------------------------------------------------------------- > import gnu.io.CommPortIdentifier; > import gnu.io.NoSuchPortException; > import gnu.io.PortInUseException; > import gnu.io.SerialPort; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class Main { > > public static void main(String[] args) { > > try { > > if (args.length == 0) { > System.out.println("specify port name! System exits."); > System.exit(0); > } > > String port = args[0].toLowerCase(); > CommPortIdentifier portId = > CommPortIdentifier.getPortIdentifier(port); > SerialPort serialPort = (SerialPort) > portId.open("SMSLib", 1971); > System.out.println("Serial port name: " + > serialPort.getName()); > serialPort.close(); > } catch (PortInUseException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } catch (NoSuchPortException ex) { > Logger.getLogger(Main.class.getName()).log(Level.SEVERE, > null, ex); > } > } > > } > --------------------------------------------------------------------------------------------------- > > when trying to execute got exceptions: > 1 - java.lang.ClassCastException: gnu.io.RXTXCommDriver while > loading driver gnu.io.RXTXCommDriver > 2 - java.io.FileNotFoundException: > nullnullgnu.io.rxtx.properties (No such file or directory) I think it should be looking for "/gnu/io/rxtx.properties", so something is a little odd. Do you have the full exception available? How did you build the Java source? Andre From netbeans at gatworks.com Tue Dec 18 19:40:09 2007 From: netbeans at gatworks.com (U. George) Date: Tue, 18 Dec 2007 21:40:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> Message-ID: <47688489.4010804@gatworks.com> >> loading driver gnu.io.RXTXCommDriver >> 2 - java.io.FileNotFoundException: >> nullnullgnu.io.rxtx.properties (No such file or directory) > > I think it should be looking for "/gnu/io/rxtx.properties", so > something is a little > odd. > Hint: nullnullgnu.io.rxtx.properties can be composed from ( devel "RXTXCommDriver.java::409 ) : String ext_dir = System.getProperty("java.ext.dirs") + System.getProperty("file.separator"); FileInputStream rxtx_prop = new FileInputStream(ext_dir+"gnu.io.rxtx.properties"); if java.ext.dirs == null and file.separator == null THEN you will get the 2 null's in front of the "nullnullgnu.io.rxtx.properties" Yes there is something wrong. Its just not the location of the property file. maybe you can try printing out the results of the system peoperty's 1) System.getProperty("java.ext.dirs") 2) System.getProperty("file.separator") 3) java -version // just in case its not what u think From aleksandrb at gmail.com Wed Dec 19 01:44:12 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 10:44:12 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> Message-ID: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Thanks for your replies, I'm now going through Extensions Mechanizm Architecture manual. I've found that place where path to rxtx.gnu.io.properties file is built and noticed that it is null, but I don't understand yet where I should define "java.ext.dirs" property, could you please save a bit of my time and tell me where it must be defined? ... proceeding with extensions manual :) ps. sorry for sending previous e-mail directly to you, George, not to mailing list. From netbeans at gatworks.com Wed Dec 19 04:26:37 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 06:26:37 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> Message-ID: <4768FFED.7010000@gatworks.com> Aleksandr Bissekerskij wrote: > I've found that place where path to rxtx.gnu.io.properties file is > built and noticed that it is null, but I don't understand yet where I > should define "java.ext.dirs" property, could you please save a bit of > my time and tell me where it must be defined? > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ -Dfile.separator=/ \ // rest of java args I suppose u cant tell me how u got to nuke java so much that these per-system definitions are null? I suppose it has something to do with a jar, with a signature. From aleksandrb at gmail.com Wed Dec 19 07:01:15 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Wed, 19 Dec 2007 16:01:15 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4768FFED.7010000@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> Message-ID: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> got this output when executing "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1" ----------------------------------------------------------------------------------------------------- java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar /dev/ttyS1 RXTXCommDriver {} Experimental: JNI_OnLoad called. Stable Library ========================================= Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 RXTXCommDriver: Jar version = RXTX-2.1-7 native lib Version = RXTX-2.1-7 RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os FreeBSD Entering registerValidPorts() Candidate devices: network geom.ctl devctl null zero klog pci console ctty random urandom fido nfslock io sysmouse fd stdin stdout stderr kbdmux0 kbd1 mem kmem ata acpi apm ciss0 net net1 net2 usb0 usb usb1 usb2 usb3 usb4 usb5 atkbd0 kbd0 psm0 bpsm0 ttyd0 ttyd0.init ttyd0.lock cuad0 cuad0.init cuad0.lock ttyv0 ttyv1 ttyv2 ttyv3 ttyv4 ttyv5 ttyv6 ttyv7 ttyv8 ttyv9 ttyva ttyvb ttyvc ttyvd ttyve ttyvf consolectl ttyd1 ttyd1.init ttyd1.lock cuad1 cuad1.init cuad1.lock ukbd0 kbd2 nfs4 net3 mdctl devstat acd0 xpt0 pass0 pass1 da0 da1 da0s1 da1s1 da0s1a da0s1b da0s1c da0s1d da0s1e da0s1f da1s1c da1s1d log ptyp0 ttyp0 ptyp1 ttyp1 ptyp2 ttyp2 ptyp3 ttyp3 ptyp4 ttyp4 ptyp5 ttyp5 ptyp6 ttyp6 ptyp7 ttyp7 ptyp8 ttyp8 ptyp9 ttyp9 ptypf ttypf ptySv ptyS1 ttyS1 valid port prefixes: lpt Leaving registerValidPorts() Exception in thread "main" java.lang.ExceptionInInitializerError at testcomport.SimpleRead.main(SimpleRead.java:45) at testcomport.Main.main(Main.java:27) Caused by: java.lang.NullPointerException at gnu.io.CommPortIdentifier.(CommPortIdentifier.java:78) ... 2 more ----------------------------------------------------------------------------------------------------- I've added to my testComPort.jar this piece of code: ----------------------------------------------------------------------------------------------------- SimpleRead.main(args); // this is standard SimpleRead.java sample String ext_dir=System.getProperty("java.ext.dirs")+System.getProperty("file.separator"); System.out.println("ext_dir: " + ext_dir); System.exit(0); // exit ----------------------------------------------------------------------------------------------------- what about explanations how I got jre which doesn't have system params you are right - I cant explain it... as you see from output it has not changed (except the second exception which is now NullPointerException from SimpleRead.java instead of CastException cause I skipped my code), rxtx.gnu.io.properties is still not found On Dec 19, 2007 1:26 PM, U. George wrote: > Aleksandr Bissekerskij wrote: > > > I've found that place where path to rxtx.gnu.io.properties file is > > built and noticed that it is null, but I don't understand yet where I > > should define "java.ext.dirs" property, could you please save a bit of > > my time and tell me where it must be defined? > > > java -Djava.ext.dirs=/usr/local/java/jre/lib/ext/ \ > -Dfile.separator=/ \ > // rest of java args > > I suppose u cant tell me how u got to nuke java so much that these > per-system definitions are null? I suppose it has something to do with a > jar, with a signature. > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Wed Dec 19 08:54:09 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 10:54:09 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47693EA1.90802@gatworks.com> Aleksandr Bissekerskij wrote: > got this output when executing > "java -Djava.ext.dirs=/usr/local/jdk1.5.0/jre/lib/ext > -Dfile.separator=/ -jar /mnt/data/tmp/testComPort_GNU2/testComPort.jar > /dev/ttyS1" what does java -version say? From netbeans at gatworks.com Wed Dec 19 09:14:57 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 11:14:57 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> Message-ID: <47694381.8090608@gatworks.com> > checking registry for ports of type 1 > > RXTXCommDriver:addSpecifiedPorts() > The file: gnu.io.rxtx.properties doesn't exists. > java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such > file or directory) > checking for system-known ports of type 2 > checking registry for ports of type 2 > scanning device directory /dev/ for ports of type 2 > Ok, so now I can recreate your issue. I'll try rxtx-devel to see if also there. BTW: I suspect it found the property file, once. But failed horribly when it tried paralley ports. .... ---------------------------------------------------------- RXTXCommDriver:initialize() checking for system-known ports of type 1 checking registry for ports of type 1 RXTXCommDriver:addSpecifiedPorts() The file: gnu.io.rxtx.properties doesn't exists. java.io.FileNotFoundException: nullnullgnu.io.rxtx.properties (No such file or directory) checking for system-known ports of type 2 checking registry for ports of type 2 scanning device directory /dev/ for ports of type 2 scanning for parallel ports for os Linux Entering registerValidPorts() From netbeans at gatworks.com Wed Dec 19 10:46:52 2007 From: netbeans at gatworks.com (U. George) Date: Wed, 19 Dec 2007 12:46:52 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <47694381.8090608@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> Message-ID: <4769590C.3020601@gatworks.com> U. George wrote: >> checking registry for ports of type 1 Issue appears to be fixed for rxtx-devel. ( thats the CVS method of fetching sources ) Good Luck From ajmas at sympatico.ca Wed Dec 19 15:50:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Wed, 19 Dec 2007 17:50:31 -0500 Subject: [Rxtx] 2.1-8? Message-ID: Hi, With having to tell people to get the latest source from CVS, I am wondering what is stopping using the current 2.1 head in CVS as 2.1-8? Andre From gregory.dupriez at gmail.com Thu Dec 20 01:01:40 2007 From: gregory.dupriez at gmail.com (Gregory Dupriez) Date: Thu, 20 Dec 2007 09:01:40 +0100 Subject: [Rxtx] Issue with RXTX library - Jvm crash Message-ID: Hi everybody, I currently have some issue with the RXTX library version 2.1-7r2. When I try to send to send some data to my parallel port, jvm crashes. But it doesn't happen all the time. It seems to be dependant on the data. It seems to be the same issue that the one described on the mailing list within this post http://mailman.qbang.org/pipermail/rxtx/2005-April/1765742.html I've put the report of the jvm crash at the end of my mail. It's quite an old issue but if somobody has solved the problem, it will help me a lot. I already try with different versions of the rxtx library and different versions of the jvm but with the same result. In advance, thanks for your help. Regards, Gregory Dupriez # # An unexpected error has been detected by HotSpot Virtual Machine: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c93ae22, pid=2328, tid=4020 # # Java VM: Java HotSpot(TM) Client VM (1.5.0_14-b03 mixed mode, sharing) # Problematic frame: # C [ntdll.dll+0x2ae22] # --------------- T H R E A D --------------- Current thread (0x02ca3800): JavaThread "Thread-19" [_thread_in_native, id=4020] siginfo: ExceptionCode=0xc0000005, reading address 0x2d2d2d2d Registers: EAX=0x2d2d2d2d, EBX=0x00000000, ECX=0x2d2d2d2d, EDX=0x00090608 ESP=0x0349f774, EBP=0x0349f830, ESI=0x000d5728, EDI=0x00090000 EIP=0x7c93ae22, EFLAGS=0x00010207 Top of Stack: (sp=0x0349f774) 0x0349f774: 02ca3800 26fa64e8 6d6d059c 00000000 0x0349f784: 00002008 02d61008 0349f7dc 00030178 0x0349f794: 7c91d664 7c80a6da 00000000 00000000 0x0349f7a4: 0349f7e0 7c80a6fe 00000000 02ca3800 0x0349f7b4: 00000000 2d2d2d2d 01013de0 2d2d2d2d 0x0349f7c4: 000d5728 77bfc3ce 0349f814 00016968 0x0349f7d4: 7c81100e 00000cc8 00000000 00000000 0x0349f7e4: 00000000 0349f810 000d3de0 00001968 Instructions: (pc=0x7c93ae22) 0x7c93ae12: 75 cc 89 75 94 8b 06 89 45 90 8b 4e 04 89 4d 88 0x7c93ae22: 8b 11 3b 50 04 0f 85 93 d1 ff ff 3b d6 0f 85 8b Stack: [0x03460000,0x034a0000), sp=0x0349f774, free space=253k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x2ae22] C [crtdll.dll+0xc4d7] j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j com.kiala.hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub V [jvm.dll+0x875dd] V [jvm.dll+0xdfd96] V [jvm.dll+0x874ae] V [jvm.dll+0x8720b] V [jvm.dll+0xa2089] V [jvm.dll+0x1112e8] V [ jvm.dll+0x1112b6] C [MSVCRT.dll+0x2a3b0] C [kernel32.dll+0xb50b] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j gnu.io.LPRPort.writeArray([BII)V+0 j gnu.io.LPRPort$ParallelOutputStream.write ([BII)V+25 j java.io.BufferedOutputStream.flushBuffer()V+20 j java.io.BufferedOutputStream.flush()V+1 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.sendStream ()V+85 j hub.client.labelprinting.WriteTimeoutHandler$SenderThread.run ()V+9 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) =>0x02ca3800 JavaThread "Thread-19" [_thread_in_native, id=4020] 0x02fd1a90 JavaThread "RMI ConnectionExpiration-[192.168.1.2:2527]" daemon [_thread_blocked, id=2308] 0x00035e90 JavaThread "DestroyJavaVM" [_thread_blocked, id=2264] 0x02dfec18 JavaThread "Timer-1" [_thread_blocked, id=3928] 0x00a9a618 JavaThread "TimerQueue" daemon [_thread_blocked, id=2560] 0x02fefe68 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1212] 0x00ac4408 JavaThread "AWT-Shutdown" [_thread_blocked, id=2708] 0x02ff3d08 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3820] 0x03017ec8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3732] 0x0300be68 JavaThread "Direct Clip" daemon [_thread_blocked, id=3708] 0x03000c30 JavaThread "Direct Clip" daemon [_thread_blocked, id=1848] 0x02ff31d8 JavaThread "Direct Clip" daemon [_thread_blocked, id=3560] 0x02ff2450 JavaThread "Direct Clip" daemon [_thread_blocked, id=2128] 0x02f02110 JavaThread "Direct Clip" daemon [_thread_blocked, id=2180] 0x02fd7e28 JavaThread "Direct Clip" daemon [_thread_blocked, id=3556] 0x02fd76d8 JavaThread "Java Sound Event Dispatcher" daemon [_thread_blocked, id=1244] 0x02fd1d78 JavaThread "Timer-0" daemon [_thread_blocked, id=596] 0x02fd0028 JavaThread "GC Daemon" daemon [_thread_blocked, id=2792] 0x02fcfcd0 JavaThread "RMI RenewClean-[192.168.1.2:2527]" daemon [_thread_blocked, id=1320] 0x02f9c7e0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3940] 0x00a71ef0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=2676] 0x00a70ad0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1492] 0x00a6fe40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=1592] 0x0003fcb0 JavaThread "Finalizer" daemon [_thread_blocked, id=3676] 0x0003e830 JavaThread "Reference Handler" daemon [_thread_blocked, id=4016] Other Threads: 0x00a429e0 VMThread [id=3392] 0x00a73148 WatcherThread [id=3304] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap def new generation total 576K, used 113K [0x22a50000, 0x22af0000, 0x22f30000) eden space 512K, 19% used [0x22a50000, 0x22a68da0, 0x22ad0000) from space 64K, 21% used [0x22ae0000, 0x22ae3838, 0x22af0000) to space 64K, 0% used [0x22ad0000, 0x22ad0000, 0x22ae0000) tenured generation total 3976K, used 3413K [0x22f30000, 0x23312000, 0x26a50000) the space 3976K, 85% used [0x22f30000, 0x232854d8, 0x23285600, 0x23312000) compacting perm gen total 8192K, used 6303K [0x26a50000, 0x27250000, 0x2aa50000) the space 8192K, 76% used [0x26a50000, 0x27077eb0, 0x27078000, 0x27250000) ro space 8192K, 63% used [0x2aa50000, 0x2af62218, 0x2af62400, 0x2b250000) rw space 12288K, 47% used [0x2b250000, 0x2b7f75b8, 0x2b7f7600, 0x2be50000) Dynamic libraries: 0x00400000 - 0x0040d000 C:\apps\Java\jre1.5.0_14\bin\java.exe 0x7c910000 - 0x7c9c7000 C:\WINDOWS\system32\ntdll.dll 0x7c800000 - 0x7c904000 C:\WINDOWS\system32\kernel32.dll 0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll 0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll 0x77be0000 - 0x77c38000 C:\WINDOWS\system32\MSVCRT.dll 0x6d640000 - 0x6d7de000 C:\apps\Java\jre1.5.0_14\bin\client\jvm.dll 0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll 0x77ef0000 - 0x77f36000 C:\WINDOWS\system32\GDI32.dll 0x76ae0000 - 0x76b0f000 C:\WINDOWS\system32\WINMM.dll 0x76320000 - 0x7633d000 C:\WINDOWS\system32\IMM32.DLL 0x6d290000 - 0x6d298000 C:\apps\Java\jre1.5.0_14\bin\hpi.dll 0x76ba0000 - 0x76bab000 C:\WINDOWS\system32\PSAPI.DLL 0x6d610000 - 0x6d61c000 C:\apps\Java\jre1.5.0_14\bin\verify.dll 0x6d310000 - 0x6d32d000 C:\apps\Java\jre1.5.0_14\bin\java.dll 0x6d630000 - 0x6d63f000 C:\apps\Java\jre1.5.0_14\bin\zip.dll 0x6d000000 - 0x6d16d000 C:\apps\Java\jre1.5.0_14\bin\awt.dll 0x72f50000 - 0x72f76000 C:\WINDOWS\system32\WINSPOOL.DRV 0x774a0000 - 0x775dc000 C:\WINDOWS\system32\ole32.dll 0x5b090000 - 0x5b0c8000 C:\WINDOWS\system32\uxtheme.dll 0x736b0000 - 0x736f9000 C:\WINDOWS\system32\ddraw.dll 0x73b10000 - 0x73b16000 C:\WINDOWS\system32\DCIMAN32.dll 0x74690000 - 0x746db000 C:\WINDOWS\system32\MSCTF.dll 0x75140000 - 0x7516e000 C:\WINDOWS\system32\msctfime.ime 0x7c9d0000 - 0x7d1f2000 C:\WINDOWS\system32\shell32.dll 0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll 0x77390000 - 0x77492000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll 0x58b50000 - 0x58be7000 C:\WINDOWS\system32\comctl32.dll 0x0ffd0000 - 0x0fff8000 C:\WINDOWS\system32\rsaenh.dll 0x76960000 - 0x76a15000 C:\WINDOWS\system32\USERENV.dll 0x6fee0000 - 0x6ff34000 C:\WINDOWS\system32\netapi32.dll 0x6d4d0000 - 0x6d4e3000 C:\apps\Java\jre1.5.0_14\bin\net.dll 0x719f0000 - 0x71a07000 C:\WINDOWS\system32\WS2_32.dll 0x719e0000 - 0x719e8000 C:\WINDOWS\system32\WS2HELP.dll 0x71990000 - 0x719d0000 C:\WINDOWS\System32\mswsock.dll 0x76ed0000 - 0x76ef7000 C:\WINDOWS\system32\DNSAPI.dll 0x76f60000 - 0x76f68000 C:\WINDOWS\System32\winrnr.dll 0x76f10000 - 0x76f3d000 C:\WINDOWS\system32\WLDAP32.dll 0x76f70000 - 0x76f76000 C:\WINDOWS\system32\rasadhlp.dll 0x62e40000 - 0x62e99000 C:\WINDOWS\system32\hnetcfg.dll 0x719d0000 - 0x719d8000 C:\WINDOWS\System32\wshtcpip.dll 0x6d5f0000 - 0x6d5f6000 C:\apps\Java\jre1.5.0_14\bin\rmi.dll 0x6d480000 - 0x6d4a5000 C:\apps\Java\jre1.5.0_14\bin\jsound.dll 0x6d4b0000 - 0x6d4b8000 C:\apps\Java\jre1.5.0_14\bin\jsoundds.dll 0x73e60000 - 0x73ebc000 C:\WINDOWS\system32\DSOUND.dll 0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll 0x76be0000 - 0x76c0e000 C:\WINDOWS\system32\WINTRUST.dll 0x779e0000 - 0x77a76000 C:\WINDOWS\system32\CRYPT32.dll 0x77a80000 - 0x77a92000 C:\WINDOWS\system32\MSASN1.dll 0x76c40000 - 0x76c68000 C:\WINDOWS\system32\IMAGEHLP.dll 0x72c70000 - 0x72c79000 C:\WINDOWS\system32\wdmaud.drv 0x72c60000 - 0x72c68000 C:\WINDOWS\system32\msacm32.drv 0x77bb0000 - 0x77bc5000 C:\WINDOWS\system32\MSACM32.dll 0x77ba0000 - 0x77ba7000 C:\WINDOWS\system32\midimap.dll 0x73e30000 - 0x73e34000 C:\WINDOWS\system32\KsUser.dll 0x6d240000 - 0x6d290000 C:\apps\Java\jre1.5.0_14\bin\fontmanager.dll 0x10000000 - 0x10012000 C:\test\hub-client-install\lib\rxtx\rxtxSerial.dll 0x73ce0000 - 0x73d07000 C:\WINDOWS\system32\crtdll.dll 0x03b30000 - 0x03b3d000 C:\test\hub-client-install\lib\rxtx\rxtxParallel.dll 0x6d4f0000 - 0x6d4f9000 C:\apps\Java\jre1.5.0_14\bin\nio.dll VM Arguments: jvm_args: -Xverify:none -Djava.library.path=..\lib\rxtx\;..\lib\jdesktop\ java_command: hub.client.HubMain -c file://../config/hub_scanclient_config.xml Launcher Type: SUN_STANDARD Environment Variables: JAVA_HOME=C:\apps\Java\jre1.5.0_14 PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\apps\maven- 2.0.7\bin;C:\Program Files\OpenVPN\bin USERNAME=gregory OS=Windows_NT PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD --------------- S Y S T E M --------------- OS: Windows XP Build 2600 Service Pack 2 CPU:total 1 (cores per cpu 1, threads per core 1) family 6 model 6 stepping 2, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow Memory: 4k page, physical 261616k(46936k free), swap 633024k(121824k free) vm_info: Java HotSpot(TM) Client VM (1.5.0_14-b03) for windows-x86, built on Oct 5 2007 01:21:52 by "java_re" with MS VC++ 6.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/b78e9bc3/attachment-0015.html From lyon at docjava.com Thu Dec 20 04:23:45 2007 From: lyon at docjava.com (Dr. Douglas Lyon) Date: Thu, 20 Dec 2007 06:23:45 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: Hi All, I have a Keyspan 19HS with the driver installed under parallels/windows xp. It works great with RXTX on the Intel Mac. However, parallels does not pick up the usb device (according to the keyspan serial assistant). Does anyone have experience with this kind of a setup? Thanks! - DL From aleksandrb at gmail.com Thu Dec 20 04:24:57 2007 From: aleksandrb at gmail.com (Aleksandr Bissekerskij) Date: Thu, 20 Dec 2007 13:24:57 +0200 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <4769590C.3020601@gatworks.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> Message-ID: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Thank you for help, but again I have a problem :) I've updated rxtx sources from CVS, but when I try to install it on freeBSD "make" command fails, I suppose this is adaptation for freeBSD issue and I have no idea how to do this --------------------------------------------------- # make Error expanding embedded variable. --------------------------------------------------- On Dec 19, 2007 7:46 PM, U. George wrote: > U. George wrote: > >> checking registry for ports of type 1 > Issue appears to be fixed for rxtx-devel. ( thats the CVS method of > fetching sources ) > > Good Luck > > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx > From netbeans at gatworks.com Thu Dec 20 04:53:00 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 06:53:00 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A579C.1090809@gatworks.com> Well, u are full of issues! :) Do u have "gmake" ? if not: u can, *possibly*, fix it by ( read instructions first ) 1) in rxtx-2.1-7r2 directory, "mv src src.2.1-7r2" 2) ln -s /path/to/rxtx-devel/src src 3) make 4) make install Here I just link in the src from the devel src tree to the 2.1-7r2 src tree. U can also mv all the src. I wouldn't as it fogs up src lineage. Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) From netbeans at gatworks.com Thu Dec 20 05:05:07 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 07:05:07 -0500 Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: <476A5A73.9050503@gatworks.com> U can also take the makefile from rxtx-2.1-7r2 to rxtx-devel. u might have to change any hard-coded directory paths > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- From Eric.Arseneau at sun.com Thu Dec 20 09:14:10 2007 From: Eric.Arseneau at sun.com (Eric Arseneau) Date: Thu, 20 Dec 2007 08:14:10 -0800 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: <63FEBD4F-ACE5-4EA3-AE8B-32D4E1314B5B@sun.com> I work on Sun SPOTs which behave like serial devices on the USB bus directly. I have found that Parallels is not as good as vmWare fusion with USB devices as a general rule. Our Sun SPOTs do not enumerate on Parallel, but do fine on Fusion. So I think your problem is more related to that than to RXTX. This was the reason we switched to Fusion. On Dec 20, 2007, at 3:23 AM, Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! > - DL > _______________________________________________ > Rxtx mailing list > Rxtx at qbang.org > http://mailman.qbang.org/mailman/listinfo/rxtx From griff at op.pl Thu Dec 20 13:15:07 2007 From: griff at op.pl (Piotr Zielniok) Date: Thu, 20 Dec 2007 21:15:07 +0100 Subject: [Rxtx] Time interval between reading bytes. Message-ID: <476ACD4B.9060900@op.pl> Hi, Is that any possibility to configure time interval between reading (writing) bytes to serial port? For now before reading from inputStream (inputStream.read()) I am waiting 50ms (Thread.sleep(50)) so that code looks like Object method(InputStream inputStream) { .... for (something) { Thread.sleep(50); inputStream.read(); .... } .... } Without "sleep" line I am receiving some strange data from port. The problem is that I have also device simulator and it is represented by inputStream (and outputStream) objects. So when I'm running my automated tests I don't want Thread.sleep(50) line in the code because it increases test execution time. And on the other hand I don't want my code to be pollute by communication specific things and Thread.sleep(50) is such a thing. So, If there was a possibility to configure such interval I could delete this unwanted line. Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071220/49f76b8b/attachment-0014.html From tjarvi at qbang.org Thu Dec 20 18:43:55 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 18:43:55 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Wed, 19 Dec 2007, Andre-John Mas wrote: > Hi, > > With having to tell people to get the latest source from CVS, I am > wondering > what is stopping using the current 2.1 head in CVS as 2.1-8? > > Andre > Hi Andre We will probably be making a prerelease series soon. That would be binaries people can try. I'm a bit overloaded right now but I have vacation days comming up. There are a couple threads on the list I need to dig through and see if we are doing anything about them. Then double check the open bugs in bugzilla and make sure there isnt something we can take care of. Finally, I need to see if I have everything from my end in CVS. Things I will be looking at: 1) Martin proposed a better solaris enumaration patch. 2) George has a debug cleanup 3) We have a long thread about smp systems and threads in which I did not see a final solution for. 4) I have some src code for rxtx in transition at work that needs to be checked - It may all be in already. If there is anything missed, bugzilla with a patch is sure to get attention. -- Trent Jarvi tjarvi at qbang.org From netbeans at gatworks.com Thu Dec 20 19:36:26 2007 From: netbeans at gatworks.com (U. George) Date: Thu, 20 Dec 2007 21:36:26 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: <476B26AA.4020306@gatworks.com> > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup ???? 2a) TIOCGETLSR et al ? 2b) drain_loop eis/thread/coordination ? > 3) We have a long thread about smp systems and threads in which I did > not see a final solution for. I didnt see any either. I vote for the removal of IOLocked++, and syncronize the close(). > 4) I have some src code for rxtx in transition at work that needs to be > checked - It may all be in already. There seems to be a bsd/makefile issue that just showed this morning. From tjarvi at qbang.org Thu Dec 20 19:54:20 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 19:54:20 -0700 (MST) Subject: [Rxtx] problem with configuring RxTx under freeBSD In-Reply-To: <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> References: <8bc552b60712180403h636a5749g2794fe891b39bf11@mail.gmail.com> <4BBD36A1-49BD-4056-984F-1FCFAB4E1386@sympatico.ca> <47688489.4010804@gatworks.com> <8bc552b60712190042l5cc31ca3x3d3f38992b7aa8e6@mail.gmail.com> <8bc552b60712190044na8e68c1kafbcc3c5d28d6839@mail.gmail.com> <4768FFED.7010000@gatworks.com> <8bc552b60712190601v39e89e17t99e7ece79d99a0@mail.gmail.com> <47694381.8090608@gatworks.com> <4769590C.3020601@gatworks.com> <8bc552b60712200324o29e84abamf2ce32d2170587bc@mail.gmail.com> Message-ID: rxtx uses GNU make'isms. On other systems, it is sometimes called 'gmake' I suspect if you call gmake or the path to GNU make, things will improve. On Thu, 20 Dec 2007, Aleksandr Bissekerskij wrote: > Thank you for help, but again I have a problem :) > > I've updated rxtx sources from CVS, but when I try to install it on > freeBSD "make" command fails, I suppose this is adaptation for freeBSD > issue and I have no idea how to do this > --------------------------------------------------- > # make > Error expanding embedded variable. > --------------------------------------------------- > > > On Dec 19, 2007 7:46 PM, U. George wrote: >> U. George wrote: >>>> checking registry for ports of type 1 >> Issue appears to be fixed for rxtx-devel. ( thats the CVS method of >> fetching sources ) >> >> Good Luck >> >> _______________________________________________ >> Rxtx mailing list >> Rxtx at 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 Thu Dec 20 20:06:21 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:06:21 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: <476B26AA.4020306@gatworks.com> References: <476B26AA.4020306@gatworks.com> Message-ID: On Thu, 20 Dec 2007, U. George wrote: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup > ???? > 2a) TIOCGETLSR et al ? It was unclear that there was actually a clean resolution. We can still treat it as a bug and deal with it if not. I thought you had discovered the kernel driver issues and mumbled something :) > 2b) drain_loop eis/thread/coordination ? As I mentioned, I need to go through the threads. Do we have a clean patch for this? In a sense this is the LSR issue. It makes sense. >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. > I didnt see any either. I vote for the removal of IOLocked++, and syncronize > the close(). Nods. We'll really need to test that change. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > There seems to be a bsd/makefile issue that just showed this morning. > With luck it was just a GNUism. SysV/BSD have another make by default. -- Trent Jarvi tjarvi at qbang.org From ajmas at sympatico.ca Thu Dec 20 20:49:27 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Thu, 20 Dec 2007 22:49:27 -0500 Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > On Wed, 19 Dec 2007, Andre-John Mas wrote: > >> Hi, >> >> With having to tell people to get the latest source from CVS, I am >> wondering >> what is stopping using the current 2.1 head in CVS as 2.1-8? >> >> Andre >> > > Hi Andre > > We will probably be making a prerelease series soon. That would be > binaries people can try. I'm a bit overloaded right now but I have > vacation days comming up. > > There are a couple threads on the list I need to dig through and see > if we are doing anything about them. Then double check the open > bugs in bugzilla and make sure there isnt something we can take care > of. Finally, I need to see if I have everything from my end in CVS. > > Things I will be looking at: > > 1) Martin proposed a better solaris enumaration patch. > 2) George has a debug cleanup > 3) We have a long thread about smp systems and threads in which I > did not see a final solution for. > 4) I have some src code for rxtx in transition at work that needs to > be checked - It may all be in already. I have just noticed that the changes for supporting universal binaries, on MacOS X, never got into the configuration tool. I see no traces in the CVS history. The original thread covering the subject is here: http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html It looks like I will need to reintegrate the changes and create a diff. Would you be willing to check this in if I get it to you? Andre From tjarvi at qbang.org Thu Dec 20 20:52:12 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Thu, 20 Dec 2007 20:52:12 -0700 (MST) Subject: [Rxtx] 2.1-8? In-Reply-To: References: Message-ID: On Thu, 20 Dec 2007, Andre-John Mas wrote: > > On 20-Dec-07, at 20:43 , Trent Jarvi wrote: > >> On Wed, 19 Dec 2007, Andre-John Mas wrote: >> >>> Hi, >>> >>> With having to tell people to get the latest source from CVS, I am >>> wondering >>> what is stopping using the current 2.1 head in CVS as 2.1-8? >>> >>> Andre >>> >> >> Hi Andre >> >> We will probably be making a prerelease series soon. That would be >> binaries people can try. I'm a bit overloaded right now but I have >> vacation days comming up. >> >> There are a couple threads on the list I need to dig through and see if we >> are doing anything about them. Then double check the open bugs in bugzilla >> and make sure there isnt something we can take care of. Finally, I need to >> see if I have everything from my end in CVS. >> >> Things I will be looking at: >> >> 1) Martin proposed a better solaris enumaration patch. >> 2) George has a debug cleanup >> 3) We have a long thread about smp systems and threads in which I did not >> see a final solution for. >> 4) I have some src code for rxtx in transition at work that needs to be >> checked - It may all be in already. > > I have just noticed that the changes for supporting universal binaries, on > MacOS X, never got > into the configuration tool. I see no traces in the CVS history. > > The original thread covering the subject is here: > > http://mailman.qbang.org/pipermail/rxtx/2006-December/1772014.html > > It looks like I will need to reintegrate the changes and create a diff. Would > you be willing to > check this in if I get it to you? > > Andre Absolutely. -- Trent Jarvi tjarvi at qbang.org From michael.erskine at ketech.com Fri Dec 21 02:36:31 2007 From: michael.erskine at ketech.com (Michael Erskine) Date: Fri, 21 Dec 2007 09:36:31 +0000 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476ACD4B.9060900@op.pl> References: <476ACD4B.9060900@op.pl> Message-ID: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Piotr Zielniok wrote: > Is that any possibility to configure time interval between reading > (writing) bytes to serial port? Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? Regards, Michael Erskine. From griff at op.pl Fri Dec 21 15:39:47 2007 From: griff at op.pl (Piotr Zielniok) Date: Fri, 21 Dec 2007 23:39:47 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> Message-ID: <476C40B3.4060607@op.pl> Michael Erskine wrote: > Piotr Zielniok wrote: > >> Is that any possibility to configure time interval between reading >> (writing) bytes to serial port? >> > > Typically the SerialPortEventListener is used instead of polling for data so reads are only performed upon bytes becoming available. > > If you wish to carry on with your sleep technique, what's to stop you making your sleep value configurable? > > Regards, > Michael Erskine So you suggest that I should use SerialPortEventListener and than abstract it by my own implementation of InputStream based on this listener? Its brings question why current implementation of InputStram.read() don't follow javadoc that "This method blocks until input data is available". Piotr Zielniok -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071221/209ee184/attachment-0013.html From netbeans at gatworks.com Fri Dec 21 16:12:39 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 18:12:39 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C40B3.4060607@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> Message-ID: <476C4867.7060806@gatworks.com> > Its brings question why current implementation of InputStram.read() > don't follow javadoc that > "This method blocks until input data is available". > Technically it will block, but there are timeout values associated with the list of serial I/O devices. The event will be throw'd from the inputstream.read(), effectively terminating the read(). This stuff is detailed in the commapi docs. from commapi: > getInputStream > > public abstract InputStream getInputStream() throws IOException > > Returns an input stream. This is the only way to receive data from the communications port. If the port is unidirectional and doesn't support receiving data, then getInputStream returns null. > > The read behaviour of the input stream returned by getInputStream depends on combination of the threshold and timeout values. The possible behaviours are described in the table below: > > Threshold Timeout Read Buffer Size Read Behaviour > State Value State Value > disabled - disabled - n bytes block until any data is available > enabled m bytes disabled - n bytes block until min(m,n) bytes are available > disabled - enabled x ms n bytes block for x ms or until any data is available > enabled m bytes enabled x ms n bytes block for x ms or until min(m,n) bytes are available > > Returns: > InputStream object that can be used to read from the port > Throws: IOException > if an I/O error occurred > From ajmas at sympatico.ca Fri Dec 21 17:23:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:23:31 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: Hi, Here is the diff for supporting universal binaries on the Mac. For an extra 5c it also adds support for 64-bit Intel. The diff is done against: Working revision: 1.35.2.76 Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ configure.in,v Commit Identifier: v44aN3L0UJ6kL6Gs Sticky Tag: commapi-0-0-1 (branch: 1.35.2) Sticky Date: (none) Sticky Options: (none) If anyone wanting to apply this diff at this point in time, then all you need to do is save it to a file, 'universal.patch' for example and then from within the rxtx-devel directory: patch configure.in universal.patch Andre --- configure.in 2007-12-21 19:15:31.000000000 -0500 +++ configure.in.new 2007-12-21 19:13:29.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="-O -g -mmacosx-version-min=10.4 -isysroot $SDK -arch i386 - arch ppc -arch x86_64" + LDFLAGS="-arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Fri Dec 21 17:31:51 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Fri, 21 Dec 2007 19:31:51 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: References: Message-ID: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> On 21-Dec-07, at 19:23 , Andre-John Mas wrote: > Hi, > > Here is the diff for supporting universal binaries on the Mac. For an > extra 5c it > also adds support for 64-bit Intel. The diff is done against: > > Working revision: 1.35.2.76 > Repository revision: 1.35.2.76 /usr/local/cvsroot/rxtx-devel/ > configure.in,v > Commit Identifier: v44aN3L0UJ6kL6Gs > Sticky Tag: commapi-0-0-1 (branch: 1.35.2) > Sticky Date: (none) > Sticky Options: (none) > > If anyone wanting to apply this diff at this point in time, then all > you need to > do is save it to a file, 'universal.patch' for example and then from > within the > rxtx-devel directory: > > patch configure.in universal.patch Small note you can check whether your binary is universal with the 'file' command. For example: myhost$ file i686-apple-darwin9.1.0/librxtxSerial.jnilib i686-apple-darwin9.1.0/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc i686-apple-darwin9.1.0/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 Andre From griff at op.pl Fri Dec 21 18:27:01 2007 From: griff at op.pl (Piotr Zielniok) Date: Sat, 22 Dec 2007 02:27:01 +0100 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C4867.7060806@gatworks.com> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> Message-ID: <476C67E5.3020408@op.pl> Ok Thanks, In my case i don't touch timeout and I have a problems with strange data from read method. So I assumed that default (initial) timeout is turned on and I have to turn it off. I haven't do it yet because I don't have access to devices now. I have looked to the source 2.1.7 from CVS and I sow that in RXTXPort constructor is : timeout = -1; But in method disableReceiveTimeout() there is timeout = -1; NativeEnableReceiveTimeoutThreshold( timeout , threshold, InputBuffer ); Method NativeEnableReceiveTimeoutThreshold is not called in any construct code neither directly nor indirectly, so what is the real initial state of timeout? Piotr Zielniok U. George pisze: >> Its brings question why current implementation of InputStram.read() >> don't follow javadoc that >> "This method blocks until input data is available". >> > Technically it will block, but there are timeout values associated > with the list of serial I/O devices. The event will be throw'd from > the inputstream.read(), effectively terminating the read(). This stuff > is detailed in the commapi docs. > > from commapi: > >> getInputStream >> >> public abstract InputStream getInputStream() throws IOException >> >> Returns an input stream. This is the only way to receive data >> from the communications port. If the port is unidirectional and >> doesn't support receiving data, then getInputStream returns null. >> >> The read behaviour of the input stream returned by getInputStream >> depends on combination of the threshold and timeout values. The >> possible behaviours are described in the table below: >> >> Threshold Timeout Read Buffer Size Read Behaviour >> State Value State Value >> disabled - disabled - n bytes block until any >> data is available >> enabled m bytes disabled - n bytes block >> until min(m,n) bytes are available >> disabled - enabled x ms n bytes block for x >> ms or until any data is available >> enabled m bytes enabled x ms n bytes block >> for x ms or until min(m,n) bytes are available >> >> Returns: >> InputStream object that can be used to read from the port >> Throws: IOException >> if an I/O error occurred > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071222/d1e2f7b2/attachment-0013.html From netbeans at gatworks.com Fri Dec 21 19:02:16 2007 From: netbeans at gatworks.com (U. George) Date: Fri, 21 Dec 2007 21:02:16 -0500 Subject: [Rxtx] Time interval between reading bytes. In-Reply-To: <476C67E5.3020408@op.pl> References: <476ACD4B.9060900@op.pl> <06BA3262D918014F9183B66425D5A8D40D74DB35FD@no-sv-03.ketech.local> <476C40B3.4060607@op.pl> <476C4867.7060806@gatworks.com> <476C67E5.3020408@op.pl> Message-ID: <476C7028.6020709@gatworks.com> according to commapi: enableReceiveTimeout is an advisory method which the driver may not implement. By default, receive timeout is not enabled. to enable u need to give a timeout in milliseconds. That enables, as well as sets the timeout. Piotr Zielniok wrote: > So I assumed that default (initial) timeout is turned on and I have to > turn it off. From ajmas at sympatico.ca Sat Dec 22 12:34:02 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Sat, 22 Dec 2007 14:34:02 -0500 Subject: [Rxtx] Configure.in update In-Reply-To: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: Hi, I was just told there is a minor issue in the changes. Basically I was overwriting any LDFLAGS and CFLAGS that the user might have set, so the following diff fixes this. It is made relative to 1.35.2.76: --- configure.in 2007-12-22 14:31:54.000000000 -0500 +++ configure.in.new 2007-12-22 14:31:09.000000000 -0500 @@ -153,7 +153,7 @@ fi ) AC_ARG_ENABLE(liblock, - [ --enable-liblock[=x] enable liblock [default=no]], + [ --enable-liblock[=x] enable liblock [default=no]], if test "x$liblock" != "xno"; then echo "Using liblock" CFLAGS=$CFLAGS" -DLIBLOCKDEV" @@ -165,7 +165,7 @@ ) AC_ARG_ENABLE(lockfile_server, - [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], + [ --enable-lockfile_server Enable interaction with a lock file server [default=no]], if test x$enable_lockfile_server = xyes; then CFLAGS=$CFLAGS" -DLFS" fi @@ -176,6 +176,15 @@ CFLAGS=$CFLAGS" -DDEBUG" fi ) +AC_ARG_ENABLE(universallib, + [ --disable-universallib Disable building of universal libraries (MacOS X) [default=no]], + if test x$universallib = xyes; then + echo "Disabling universal lib" + fi +) +AC_PATH_PROG(XCODE_SELECT,xcode-select,no) + + find_java_native_include() { JAVANATINC="-I\$(JAVAINCLUDEDIR)/`cd $JAVAINCLUDEDIR; find . -name $1|sed s#$1##|head -n1`" @@ -737,8 +746,28 @@ Mac\ OS\ X) #fix_mac_groups #fix_parameters $JPATH/lib/javax.comm.properties + + if test $XCODE_SELECT = no; then + SDKPATH="/Developer" + else + SDKPATH=`$XCODE_SELECT -print-path` + fi + SDK="$SDKPATH/SDKs/MacOSX10.4u.sdk" + if test "x$enable_universallib" != xno; then + if test -d "/Developer/SDKs/MacOSX10.4u.sdk"; then + echo "library os.arch... universal (i386 ppc)" + CFLAGS="$CFLAGS -O -g -mmacosx-version-min=10.4 -isysroot $SDK - arch i386 -arch ppc -arch x86_64" + LDFLAGS="$LDFLAGS -arch i386 -arch ppc -arch x86_64" + else + echo "Warning: no universal SDK, will not build universal" + echo "library os.arch... "${OS_ARCH} + fi + else + echo "User disabled building of universal library" + echo "library os.arch... "${OS_ARCH} + fi GLIBTOOL="\$(SHELL) glibtool" - LINK="cc -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " + LINK="cc $LDFLAGS -bundle -framework CoreFoundation -framework IOKit -o librxtx\$*.jnilib " OBJECT_EXTENSION="o" LIB_EXTENSION="jnilib" TARGETLIB="\$(target_triplet)/librxtxSerial.jnilib" From ajmas at sympatico.ca Mon Dec 24 05:45:31 2007 From: ajmas at sympatico.ca (Andre-John Mas) Date: Mon, 24 Dec 2007 07:45:31 -0500 Subject: [Rxtx] parallels+intel mac In-Reply-To: References: Message-ID: On 20-Dec-07, at 06:23 , Dr. Douglas Lyon wrote: > Hi All, > I have a Keyspan 19HS with the driver installed under > parallels/windows xp. It works great with RXTX on the Intel Mac. > However, parallels does not pick up the usb device (according > to the keyspan serial assistant). > > Does anyone have experience with this kind of a setup? > Thanks! You should probably contact the Parallels developers to see if they have any suggestions. Andre From beat.arnet at gmail.com Tue Dec 25 14:30:48 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Tue, 25 Dec 2007 16:30:48 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() Message-ID: <47717688.20002@gmail.com> Hello all, It looks as if setSerialPortParams() is also setting DTR=true. In my application this is undesirable - is there anything that can be done to keep DTR==false while I reconfigure (the speed of) the port? I looked through the JAVA portion of gnu.io and could not find a single place where setDTR(true)is executed. I therefore suspect that DTR is affected by some lower-level (native) code.... Thanks for your help, Beat From tjarvi at qbang.org Tue Dec 25 17:02:59 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 17:02:59 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <47717688.20002@gmail.com> References: <47717688.20002@gmail.com> Message-ID: On Tue, 25 Dec 2007, Beat Arnet wrote: > Hello all, > It looks as if setSerialPortParams() is also setting DTR=true. In my > application this is undesirable - is there anything that can be done to > keep DTR==false while I reconfigure (the speed of) the port? I looked > through the JAVA portion of gnu.io and could not find a single place > where setDTR(true)is executed. I therefore suspect that DTR is affected > by some lower-level (native) code.... > > Thanks for your help, > Beat > The following in RXTXPort.java may help you. I was putting this code in several years ago and never really verified it. The idea is the call will open the port (DTR) will be asserted but after that, the port is 'preopened' meaning your later call to open with not assert the pin. NOTE: This is not part of CommAPI. I think it will work on the OS's RXTX supports though. /** * Extension to CommAPI * This is an extension to CommAPI. It may not be supported on * all operating systems. * * Open the port and set DTR. remove lockfile and do not close * This is so some software can appear to set the DTR before 'opening' * the port a second time later on. * * @return true on success * @throws UnsupportedCommOperationException; * */ public static boolean staticSetDTR( String port, boolean flag ) throws UnsupportedCommOperationException { if ( debug ) z.reportln( "RXTXPort:staticSetDTR( " + port + " " + flag ); return( nativeStaticSetDTR( port, flag ) ); } -- Trent Jarvi tjarvi at qbang.org From tjarvi at qbang.org Tue Dec 25 18:36:54 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Tue, 25 Dec 2007 18:36:54 -0700 (MST) Subject: [Rxtx] Configure.in update In-Reply-To: References: <7B652C77-8A24-423F-BAC4-2C5FF37EA64A@sympatico.ca> Message-ID: On Sat, 22 Dec 2007, Andre-John Mas wrote: > Hi, > > I was just told there is a minor issue in the changes. Basically I was > overwriting any > LDFLAGS and CFLAGS that the user might have set, so the following diff > fixes this. > It is made relative to 1.35.2.76: This should be in CVS Tag commapi-0-0-1 now if you want to try it. Enable universal library builds for Mac OS X Andre-John Mas ajmas at sympatico.ca http://mailman.qbang.org/pipermail/rxtx/2007-December/1793319.ht ml -- Trent Jarvi tjarvi at qbang.org From beat.arnet at gmail.com Wed Dec 26 12:52:06 2007 From: beat.arnet at gmail.com (Beat Arnet) Date: Wed, 26 Dec 2007 14:52:06 -0500 Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: References: <47717688.20002@gmail.com> Message-ID: <4772B0E6.2050803@gmail.com> Hello Trent, Thank you so much for the quick response! I have tried your suggestion, by calling staticSetDTR("COM1", false) before opening the port. Afterwards, I open the serial port and setDTR(true) followed by setDTR(false), which resets the target that I am attempting to program over RS-232. Then, I download the first portion of the code at a low transmission rate. After that, I need to reconfigure the port to run at a faster rate, for which I call setSerialPortParams() - unfortunately, even with the initial staticSetDTR call that you recommended, the setSerialPortParams() call still sets DTR=true, resulting in an unwanted reset of the target. Also, any subsequent call to staticSetDTR (after the port has been opened) results in the following error: Error 0x2 at /home/bob/foo/tar/rxtx-2.1-7/build/../src/termios.c(860): The system cannot find the file specified. Am I using the staticSetDTR function as you intended and/or is there anything else that I should try? Regards, Beat Trent Jarvi wrote: > On Tue, 25 Dec 2007, Beat Arnet wrote: > >> Hello all, >> It looks as if setSerialPortParams() is also setting DTR=true. In my >> application this is undesirable - is there anything that can be done to >> keep DTR==false while I reconfigure (the speed of) the port? I looked >> through the JAVA portion of gnu.io and could not find a single place >> where setDTR(true)is executed. I therefore suspect that DTR is affected >> by some lower-level (native) code.... >> >> Thanks for your help, >> Beat >> > > The following in RXTXPort.java may help you. I was putting this code > in several years ago and never really verified it. The idea is the > call will open the port (DTR) will be asserted but after that, the > port is 'preopened' meaning your later call to open with not assert > the pin. > > NOTE: This is not part of CommAPI. I think it will work on the OS's > RXTX supports though. > > > /** > * Extension to CommAPI > * This is an extension to CommAPI. It may not be supported on > * all operating systems. > * > * Open the port and set DTR. remove lockfile and do not close > * This is so some software can appear to set the DTR before 'opening' > * the port a second time later on. > * > * @return true on success > * @throws UnsupportedCommOperationException; > * > */ > > public static boolean staticSetDTR( String port, boolean flag ) > throws UnsupportedCommOperationException > { > if ( debug ) > z.reportln( "RXTXPort:staticSetDTR( " + port + > " " + flag ); > return( nativeStaticSetDTR( port, flag ) ); > } > > -- > Trent Jarvi > tjarvi at qbang.org > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/101ad642/attachment-0008.html From rxtx at qbang.org Wed Dec 26 15:19:24 2007 From: rxtx at qbang.org (Doctor Claudette Gary) Date: Wed, 26 Dec 2007 15:19:24 -0700 Subject: [Rxtx] December 73% OFF Message-ID: <20071226-61924.19969.qmail@pool-71-160-100-227.lsanca.dsl-w.verizon.net> An HTML attachment was scrubbed... URL: http://mailman.qbang.org/pipermail/rxtx/attachments/20071226/da5385e0/attachment-0008.html From tjarvi at qbang.org Wed Dec 26 17:48:53 2007 From: tjarvi at qbang.org (Trent Jarvi) Date: Wed, 26 Dec 2007 17:48:53 -0700 (MST) Subject: [Rxtx] Maintaining DTR=false during setSerialPortParams() In-Reply-To: <4772B0E6.2050803@gmail.com> References: <47717688.20002@gmail.com> <4772B0E6.2050803@gmail.com> Message-ID: staticSet* would be passed the filename ("COM1" for instance) even after opening the port. There may be another subtle bug there. As I mentioned that code was never tested. It looks like the problem with DTR asserting is in termios.c:tcsetattr() /* no DTR control in termios? */ dcb.fDtrControl = DTR_CONTROL_ENABLE; This function is called towards the end of setSerialPortParams in SerialImp.c. The static version will do the same. The solution may be to just remove the code that tries to fiddle with DTR while trying to emulate the termios struct. One way to test the theory would be to try it out on a Linux/Mac/Solaris box since they don't go into termios.c. Presumably they would work. Taking out that DTR code might introduce an incompatability for existing code since some devices will not communicate until it is asserted. Not that we would not do it, but it is not a change without risk. On Wed, 26 Dec 2007, Beat Arnet wrote: > Hello Trent, > > Thank you so much for the quick response! > > I have tried your suggestion, by calling staticSetDTR("COM1", false) before > opening the port. > Afterwards, I open the serial port and setDTR(true) followed by > setDTR(false), which resets the target that I am attempting to program over > RS-232. Then, I download the first portion of the code at a low transmission > rate. After that, I need to reconfigure the port to run at a faster rate, for > which I call setSerialPortParams() - unfortunately, even with the initial > staticSetDTR call that you recommended, the setSerialPortParams() call still >